Skip to main content
gamedev.net
🔒 Locked

Unicode conversion ?

Started by Ey-Lord Jan 7, 2007 at 5:47 PM 0 replies 750+ views
Original Post
Ey-Lord
Ey-Lord
Hello, i'm using SDL and i must handle the unicode for every input ( else either azerty or qwerty wont be working well). I enabled unicode

SDL_EnableUNICODE(1);
Then i just want to get the ascii char from the unicode one . I'm only trying some "normal" character like "a" or "t" , and i can't get a value ! I tried to print as the sdl_doc said :

			char ch;
			if ( (SDLEvent_.key.keysym.unicode & 0xFF80) == 0 ) {
			ch = SDLEvent_.key.keysym.unicode & 0x7F;
			}
I got a space whatever key i press, a space ( blank ) in my output ... am i missing something ? A SDL related question : a unicode is only stored when a key is pressed, why not when it's up ? I dont understand why we do this in down event and not "up" event . Edit: i just moved my SDL_EnableUnicode() and it solve my first problem ... i can get the ascii value :) Edit2 : The problem is now that if i recieve a SDL_KEYUP event, since i only have .sym available, i can't know for sure the key that is up ( ex with my azerty keyboard , if i push and release my key "a" i will see : keypushed -> unicodevalue = 97 -> "a" keyup' -> sdl_mapping value -> .sym = 113 -> "q" ( SDLK_q ) [ Sorry this can be moved to SDL forum now ] [Edited by - Ey-Lord on January 7, 2007 6:30:52 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.