[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Unprintable characters





On Tue, Mar 2, 2010 at 2:54 PM, Greg Ewing <greg.ewing@xxxxxxxxxxxxxxxx> wrote:
B W wrote:
Assuming these are UTF8 characters, the encoding is backwards compatible with ASCII. Therefore, you should be able to use the ASCII chart to classify non-printable character codes (0-31 and 127).

There's no standard ASCII code for arrow keys, however, and
I've seen at least some systems translate them into non-ASCII
unicode characters.

True. There is no ASCII code for a cursor key. Those keys send multi-byte raw ASCII sequences, unlike other keys that send a single byte. I notice Pygame (or SDL?) seems to cook them into a semblance of ASCII. However, for the Enter key on my Winders event.key reports 13 as expected, while UP arrow reports 273 (blank string?) which is higher than 255.

I haven't had a need to delve into event.unicode (<type 'unicode'>). Does it represent the raw keys? In my case, for UP arrow they are (K_ESCAPE,K_O,K_A).

Gumm