How can I insert a character code into a Linux text editor?

7

1

I need a lightweight GUI text editor on my Ubuntu Lucid system which lets me specify a Unicode code point (e.g. U+1234), and inserts that character to a UTF-8 text document. I know that gedit can't do it (not even with the Character Map plugin).

I'm not interested in solutions involving any kind of emacs or vi. I'm also not interested in text editors running in the terminal (such as joe, which has this functionality). I need the absolute simplest, smallest and fastest plain text editor for Linux which lets me type a few letters, insert a few characters by their code, type some more letters, and then save the .txt file as UTF-8-encoded.

pts

Posted 2010-08-11T21:08:34.747

Reputation: 5 441

2For the record: In Vim you can do this by pressing Ctrl+V, the letter “u” and the 4-character hex codepoint. – scy – 2010-08-11T22:33:47.400

For the record: in joe, if joe was started in a UTF-8 locale, a Unicode character can be inserted by pressing Escape, Apostrophe, X, hex, Enter; where hex is the code point in hex. – pts – 2010-08-13T07:58:02.947

Answers

13

I've found a solution which works in gedit and in the text input boxes of many other GTK-based applications. I press Ctrl+Shift+U, type the character code in hex, then I press Enter, and the character appears.

pts

Posted 2010-08-11T21:08:34.747

Reputation: 5 441

2An important note here: the unicode character only appears after you press enter. Until then, you see what you're typing (for example, for a non-breaking space: you would see u00a0 with the it all likely underlined ) – Randall – 2017-10-06T21:58:16.903

@Randall: Indeed, but this is hardly surprising. What other behavior would be reasonable? – pts – 2017-10-07T00:02:56.530

2I was just in the frame of mind of the Windows-style method for inserting extended-ASCII (where there is nothing displayed at all on the screen until releasing the Alt key), so I initially thought something wasn't configured right in Ubuntu for entering Unicode. – Randall – 2017-10-10T15:02:01.367