Handling Unicode in WxRuby

If I am using Ruby 1.8.7, what are some recommended practices for
supporting Unicode within a WxRuby application? My understanding, based
on web research, is that I should use the multibyte module of Active
Support in order to add Unicode support to Ruby 1.8.7 (Ruby 1.9 includes
Unicode support natively).

Generally, I have read the recommendation that it is best to do
everything in UTF-8. I can try to do so, but am wondering how WxRuby
handles strings that are passed to set properties, e.g., the text of a
label. Does this library expect strings to be in a certain encoding?
How can UTF-8 be specified to WxRuby?

Jamal

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 19.07.2011 02:51, schrieb Jamal M.:

If I am using Ruby 1.8.7, what are some recommended practices for
supporting Unicode within a WxRuby application? My understanding,
based on web research, is that I should use the multibyte module of
Active Support in order to add Unicode support to Ruby 1.8.7 (Ruby
1.9 includes Unicode support natively).

I’d highly recommend using Ruby 1.9. It’s much more painless.
Back in times before I switched to Ruby 1.9, I used the Iconv module
(stdlib) to convert all my strings to UTF-8. If I remember correctly, it
worked like this:

require “iconv”
ary = Iconv.iconv(“UTF-8”, “yoursourceencoding”, “1st_string”,
“2nd_string”)

Generally, I have read the recommendation that it is best to do
everything in UTF-8. I can try to do so, but am wondering how
WxRuby handles strings that are passed to set properties, e.g., the
text of a label. Does this library expect strings to be in a certain
encoding? How can UTF-8 be specified to WxRuby?

wxRuby expects your strings to be UTF-8-encoded, there’s no way to tell
wxRuby you want to use another encoding AFAIK. wxRuby just passes the
strings directly to the underlying wxWidgets, resulting in incorrect
characters being displayed in the final GUI.

Jamal

Vale,
Marvin

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOJVfUAAoJELh1XLHFkqhaLksH/R5Dp4YXAKWgrVvXcZRks2WV
bKn8IgtLTn5oPXRXu4Xsgazl/GhtOed4bw21GpNt6LKYbUPDvrHpVKMH9oJOaFXy
9WG4n+Gn3chUlmmh3eid6aVVRWKPLwU7HX3NJE66Y0NAFBo9bR6ch7d+9ELhHgQk
53sWabyfYPouvELGbigK/0DLmCiz/A3z0/9KqDxWAgCNcBdsiQjbQ4UWMjC+yNmT
Uc0pncrL9jWFLoJ6RddcS2RQUnmGUaLqAAozrq0hmWJ5csTrDxMAZ1hb8i4IYW7X
ngeTkPdOLNBRovHN9tqxbODHVQatfb4P7VhTi7H6g+ueqeAHDaIcOyZRIfZWZ5U=
=bOuD
-----END PGP SIGNATURE-----