Results 1 to 2 of 2

Thread: How to use unicode or special characters in Gedit Snippets?

  1. #1
    Join Date
    Dec 2011
    Beans
    1

    How to use unicode or special characters in Gedit Snippets?

    Hi,

    I'm creating some snipplets but there's a problem with some characters.

    For example:

    If you create a "dollar" to "$", it will work!

    If you create a "euro" to "£", it will NOT work!
    If you create a "theta" to "θ", it will NOT work!

    Not work is: the word changes to a TAB.

    What can I do to insert any characters? Is that possible?

    David

  2. #2
    Join Date
    Mar 2010
    Location
    Dublin, Ireland
    Beans
    Hidden!
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: How to use unicode or special characters in Gedit Snippets?

    Hi & welcome to the forums

    Hmmmm...that is an interesting one.

    Ok, I've never used the snippets plug-in, so I installed it and got exactly the same results as you. I found, though, that all of my snippets were lost when I quit from Gedit.

    I think this was to do with permissions on the xml file, though, so:

    Code:
    sudo chmod 666 /usr/share/gedit/plugins/snippets/global.xml
    did the trick. The special characters problem remained, however.

    On my Ubuntu 11.10 installation, the local copy of the global.xml file is stored in ~/.config/gedit/snippets. It gets corrupted when you try to add a snippet that contains a special character using the manager.

    My solution was to add the special characters by editing the global.xml file. The trick is that if you edit it using Gedit, then you get issues because it already has the file open in the background, so:

    Code:
    nano ~/.config/gedit/snippets/global.xml
    Add the special characters, as in my example below, and save the file. It will then work for you. It must be a bug in the snippets manager, because it continues to work when you add new non-special character snippets using the manager afterwards.

    Example:

    Code:
    <?xml version='1.0' encoding='utf-8'?>
    <snippets>
      <snippet>
        <description>New snippet</description>
      </snippet>
      <snippet>
        <text><![CDATA[€]]></text>
        <tag>euro</tag>
        <description>euro</description>
      </snippet>
      <snippet>
        <text><![CDATA[θ]]></text>
        <tag>theta</tag>
        <description>theta</description>
      </snippet>
    </snippets>
    Matt
    blog.mattrudge.net for extra helpings of geeky Ubuntu goodness
    Get the Ubuntu Weekly Newsletter

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •