Pharo 5.0 – Typing Accented Characters on Windows

In Pharo on Windows open a Playground.

Switch to a Czech keyboard layout.

Press 2. What?

Press 4. Really?

Switch on Caps Lock. Press 4. No Way!

Yes, way!

Člověče, nezlob se!


There is an answer?


There is an answer.

A simple answer.

Pharo 5 accented chars bug/regression
Here’s what you can do to be able to type c with caron in Pharo 3.0, 4.0, 5.0 on Windows:

You perform a little bit of brain surgery on the event handling.

*** Warning! This could void your warranty! ***
If you do this wrong, your image might stop responding to keystrokes
or mouse or just freeze altogether. Save any important data
you may have in the image before you proceed.

You modify
as follows.
After a line that goes

    charCode := evtBuf sixth.

you put another one that looks like this:

    charCode > 255 ifTrue: [ keyValue := 0 ].


If you did it right, you can now type c with caron and friends.

Specifically c with caron, e with caron, uppercase E with caron.
And some uppercase cyrilic characters.

What this does is that it trusts that the value in charCode is more reliable than
that in keyValue. The national characters with Unicode code points of over 255
get passed in to the image from the vm with bogus value of keyValue so if we
see a Unicode character with a code point of over 255 we zero the bogus value
so it can do no harm.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s