[SDL] Handling international characters

Gabriel mystml at adinet.com.uy
Fri Jun 3 10:09:27 PDT 2005

I'm having some difficulties using the unicode field in the keyboard

When the unicode character is <= 128, there's no problem - I cast to
char and everything works.

When the unicode character is > 128, I convert the unicode value (which
I assume to be in UCS-4) to UTF8, using as many bytes as needed, and
everything works. For example, when I press the 'ñ' ("LATIN SMALL LETTER
N WITH TILDE") key in my keyboard (it's a spanish keyboard), I get
unicode 0x1F, which I convert to 0xC3 0xB1, and SDL_TTF renders it
correctly (I use RenderUTF8)

However, to type the 'á' symbol ("LATIN SMALL LETTER A WITH ACUTE"), I
must press the ' ("ACUTE ACCENT") key and then the 'a' (regular A) key.
But in this case I get two key press events, one for TILDE, one for A,
instead of just one with the AACUTE.

How should this situation be handled? How do you implement international
keyboard input?


More information about the SDL mailing list