SDL2 and unicode characters from key events

Message-ID:
<CAKCUQMaLOcDYoL3uv6OZDod7=02L3r9DWK0eRSNBNqNZUcFdbQ at mail.gmail.com>
Content-Type: text/plain; charset=“iso-8859-1”

I dont remember that sdl1 unicode does not work. Can you link the bug
report or something? i only know all my sdl1 unicode works great. since my
new sdl2 code works as it’s designed and i mentioned how it’s easy, i think
a person just needs to look at the code of sdl to get the use the want for
their need. if they don’t understand the sdl code it’s hard unless the doc
makes the user not nedd the unstanding. Let’s get some doc for the
functions that make no more need to understand the sdl code. i think that’s
too much to ask.

p.s. the “right” way is the way that delivers the expected results. the
methods do not need to be what other people do. Code is art in my opinion
every bit as it is science.

sdl mail ist disclaimer:
this is my opinion. opinions can be wrong.

And in this case, your opinion is unfortunately wrong.

There are three options:

  1. You just want to know when particular keys are pressed.
    Answer) Use scancodes, and allow the user to remap keys whenever they want.

  2. You want Unicode.
    Answer) Use the text-editing events, because that’s the only way that
    you can get all Unicode characters.

  3. You want to know when keys that map directly to Unicode are pressed.
    Answer) Use keycodes, checking the high bit to determine if it carries
    a Unicode value or a scancode value.

Those are the only three options. You say that SDL1’s Unicode worked
for you? Nice, but the goal is for it to work in a more general sense.
In order to do that it needs to support the CJK characters, and to do
that the ability to modify the most recently entered character is
needed (because noone uses a keyboard big enough to provide all of the
Chinese or Japanese characters in any other way). Thus, the
text-editing api was added for the purpose of providing Unicode
support.

If you want to e.g. provide text-entry fields, then you need to
provide support for text-editing events. If you want to provide
shortcut keys (keys that cause an action to be performed when they’re
pressed, such as opening a menu or moving a character on a screen)
then you should provide the users with a way to change which keys
provide which shortcuts.

As for Richard Tew’s original post, it looks like option 1 or 2 is
correct for his situation.

You, on the other hand, have never mentioned what you want to use this
for, so we can’t actually help you with this.> Date: Sun, 12 Aug 2012 12:12:33 -0500

From: R Manard
To: SDL Development List
Subject: Re: [SDL] SDL2 and unicode characters from key events