How to input international character with SDL?

.Hi, all. How to input international character with SDL ? such as Chinese character

don’t think you can yet, except on Mac.On 03/07/2010, guoshimin wrote:

.Hi, all. How to input international character with SDL ? such as Chinese
character

I can input chinese character at wesnoth(a game, written by SDL, see http://www.wesnoth.org). but at linux, sometime i can’t input it. and if i run it at windows, i need to install a pitch for SDL. but sometime also can’t work. seems has bug. whatever, how can they do it ? (sorry, i dont know C++ well, so can’t read the source of wesnoth :frowning: ).

If you’re using SDL 1.2, I believe there are a bunch of issues if you’re
using a non-Arabic alphabet. Some might work, but you’ll need to do this
with your SDL inits:

SDL_EnableUNICODE(1);

That should make some of the international keys work, but from my
understanding, it’s a bit of a dirty hack (you’ll probably get better info
on it from Bob or Sam)

Take care,
-AlexOn Mon, Jul 5, 2010 at 1:12 PM, guoshimin wrote:

I can input chinese character at wesnoth(a game, written by SDL, see
http://www.wesnoth.org). but at linux, sometime i can’t input it. and if i
run it at windows, i need to install a pitch for SDL. but sometime also
can’t work. seems has bug. whatever, how can they do it ? (sorry, i dont
know C++ well, so can’t read the source of wesnoth [image: Sad] ).


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

yes. SDL_EnableUNICODE(1) will make some of international keys work. but such as chinese character, you can’t input it directly. you must input a character code first. and then translated by input method program, such as XIM on Xlib. But i can’t find any function to start the server of input method program :frowning:

Hi,On Mon, Jul 5, 2010 at 12:39 PM, guoshimin wrote:

yes. SDL_EnableUNICODE(1) will make some of international keys work. but
such as chinese character, you can’t input it directly. you must input a
character code first. and then translated by input method program, such as
XIM on Xlib. But i can’t find any function to start the server of input
method program [image: Sad]

Chinese and other Asian languages require more than one keypress to enter a
single unicode value, so just querying the unicode field in the key event
doesn’t work. This requires “input methods” code - Tux Paint (
www.tuxpaint.org) has code that does this, and I have struggled a bit to
start to get it adapted to work in Tux Typing (
http://tux4kids.alioth.debian.org).

Basically (speaking as an absolute non-expert), the code implements a sort
of state machine in between the key events and the rest of the program. So,
instead of the keypresses being handled immediately by Tux Paint, they get
fed into the IM “machine”, which emits the final unicode value once the
multi-key sequence is completed. The behavior of the IM software is
determined by a language-specific recipe file for each language to be
handled (e.g. Traditional Chinese, Simplified Chinese, and so forth).

It would sure be nice if this capability could be built into SDL.

David Bruce

is it mean that SDL dont directly support international character which require more than one keypress to enter a single unicode value ? i find SDL-IM is doing this work (http://sdl-im.csie.net). it modify SDL so that can make it support international character input. but still has some bug. they hope SDL developer can build it into SDL. but SDL still haven’t do that yet. :frowning:

As people previously replied, this functionality largely depends on
your platform. If you are only targeting Windows, then you may want to
support this with a Windows API directly (say, you can create a text
box with Win32 API on a external window, send the text entered to SDL
afterwards). If you are using Mac OS X, then SDL 1.3 has built-in
support for this.

  • JiangOn Tue, Jul 6, 2010 at 9:49 AM, guoshimin wrote:

is it mean that SDL dont directly support international character which require more than one keypress to enter a single unicode value ? i find SDL-IM is doing this work (http://sdl-im.csie.net). it modify SDL so that can make it support international character input. but still has some bug. they hope SDL developer can build it into SDL. but SDL still haven’t do that yet.