Hi all,
I have big problems with supporting the iso8859-2 characters in my
ruby/tk program. I have discussed it on comp.lang.tcl, but I didn’t get
a perfect solution yet, but I have reached a point where I think maybe I
can solve parts of my problem with ruby, too. Sorry, it will be long.
Although it is slightly offtopic, I have to give you a picture about the
tk part. The problem’s part a) is:
$ setxkbmap hu
$ wish
entry .e
pack .e
After that, if I type into the entry, on the machines around me I cannot
type õ and û – odoubleacute (key “[”) and udoubleacute (key "")
characters.
On some machines (namely installed with latest Mandrake, KDE), if I do
an ‘export LANG=hu_HU’ before invoking the wish script, then these keys
work. But they do not work on my debian box with icewm. For now, I
do not know what is the difference. If anybody can help, then it would
be great.
Now, the ruby-specific part b):
I use Tix combobox with the help of Hidetoshi Nagai’s tcltkextlib
wrapper. The TixCombobox can be configured to callback a proc when the
combobox’s value has changed, and this proc takes one paramter: the new
value of the combobox.
When I started using it, I realized that the parameter passed to this
callback proc is an utf8-encoded unicode string. So, I decoded it with
the command Tk.fromUTF8(val,‘iso8859-1’), and it worked on my
development machine (the debian): the decoded value was the same what I
have inserted to the combobox earlier from my script (i.e., this string
was in my script, not provided by the user).
After that I have realized the õ/û problem, and have found the LANG
setting to solve it, I have found that my tixcombobox callbacks get bad
value (not the same what I have inserted to them). If I change the
decoding command to Tk.fromUTF8(val,‘iso8859-2’), then it works on these
(Mandrake) machines. But, of course, then on my development machine goes
wrong.
So, it seems, that on one machine, the strings from my script are
interpreted as iso8859-2 strings by the (unicode-based) Tk lib, and on
another machine they are interpreted as iso8859-1 strings. In the ruby
cmdline switches I have only found the -K switch to specify Kanji
encoding. Where do ruby (or tk?) gets this two, different encodings, and
is there a way to override it?
Thanks,
Ferencc