[PATCH 1/2] Improved fix for mono bug #692206
In contrast to Xutf8LookupString, XLookupString returns the number
of characters stored in the buffer instead of a status. If the buffer
is too small the output is truncated, but we don't know it. However, it
seems pretty unlikely that a buffer of 24 chars shouldn't be enough for a
single key press, so I simplified the code a little bit.
Also, XLookupString converts the keySym to an ISO Latin-1
character so that there is no need to do an explicit conversion.
Add variable to store Ansi encoding so that we have to get it only once.
Fix a few problems encountered debugging this problem.