This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How to write foreign characters by directly entering unicode in KDE4?

Tags: None
(comma "," separated)
furryspider
Registered Member
Posts
14
Karma
0
OS
Hi everybody,

this is similar to the question found here, but not quite the same. So instead of hijacking another person's thread, I'm pestering you with another one.

Here goes:
How do I enter characters that aren't native to my keyboard layout in KDE (4.2.0) apps by using the unicode value directly?

In many (all?) GTK based apps, I have the Ctrl+Shift+U//Enter method. Isn't there anything similar for KDE? It just seems pretty awkward to me to fire up kcharselect and start searching around every time I want to enter a simple ñ or é or something.

I've been searching for the answer to this for a while now and thought it should be trivial, but apparently it isn't. Sorry if this has an obvious solution or if it has been already discussed at length. In that case I'd appreciate a link, since my searches so far came up empty.

Thanks!
- furrySpider -
User avatar
Alec
Registered Member
Posts
565
Karma
1
OS
First, pick a key you don't use often. Often people use the right logo key, but since I don't have one, I'll use the right Alt.

In the terminal run the command "xev"

This should bring up a small window. Press the key you want. You'll get an output like this:

KeyRelease event, serial 34, synthetic NO, window 0x3000001,
root 0x1a6, subw 0x0, time 120807921, (-138,567), root:(795,592),
state 0x8, keycode 108 (keysym 0xff20, Multi_key), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False


You're interested in the keycode value.

Now, open .Xmodmap file (if you don't have one, create it) and add the line (replace 108 is the value you got)
Code: Select all
keycode 108 = Multi_key


Now run "xmodmap .Xmodmap" and you have the Compose key!

Now you can various special characters by pressing (but NOT holding) the key and then a sequence. For example to create "á" you press "Compose ' a".

Here are some examples:
Compose ` a = à
Compose ^ o = ô
Compose " i = ï

You can find more here.

NOTE: If you didn't have the .Xmodmap file already (meaning your distribution does not check for it), you need to make sure that every time you start X the command "xmodmap .Xmodmap" is run!


Get problems solved faster - get reply notifications through Jabber!
furryspider
Registered Member
Posts
14
Karma
0
OS
Hi Alec,

thanks for the tip!
I remember reading about how to set up a compose key somewhere, but so far didn't think of using that approach for this issue.

It is not _quite_ what I'm looking for, though. The possibility of using the unicode value would alleviate the pain of having to use different approaches for special characters depending on the system in use (I use mainly KDE, but also have a lot of GTK apps, and at work we use that other OS). I think the GTK (or better: pango) way is a pretty decent solution. So if anyone knows of a method to enter unicode directly, I appreciate any pointers.

But if there isn't, your suggested way works very nicely for a wide range of characters, and I'll start using it right now. :-)

Cheers!
- furrySpider -
f1r3br4nd
Registered Member
Posts
16
Karma
0
Any news on this problem?

Anybody know how deeply the ctrl-shift-U feature is buried in Gnome? Maybe if it's just a shortcut that calls some specific app, I could try to get it working in KDE.
john_hudson
Registered Member
Posts
549
Karma
2
OS
Though what you want does not appear to be supported in KDE, KOffice does allow you to search for a Unicode character by its number. So perhaps you should add this as a wish to bugzilla.


John Hudson, proud to be a member of KDE forums since 2008-Oct.
mmaybee
Registered Member
Posts
1
Karma
0
OS
The compose key is very useful; you may like dead keys too if you use a lot of special characters. To get dead keys whenever you want them, enable keyboard layouts in the KDE control center. I use the US international layout for dead keys. Not all editors will recognize the Ctrl+Shift+U hexcode method of entering arbitrary UTF-8 characters like they do under Gnome, but some do, e.g., abiword. Therefore, when my document needs characters unavailable using the compose key and/or dead keys, abiword is my choice. To enter an arbitrary unicode character by hex code, hold down Ctrl+Shift and Uxxxx, e.g., U20ac gives the Euro sign. hth ☺☺


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]