[wxruby-users] Displaying special characters (like é)

Alex Fenton alex at pressure.to
Mon Jan 7 09:27:52 EST 2008


Hi Daniel

Daniel Doorduin wrote:
> When I want to display strings with special characters like é (e + /) 
> in a wxRuby gui element, only an empty string is displayed. Not only 
> the 'special' characters are hidden but all characters!
> I am using wxRuby on windows XP. It doesn't matter if I include the 
> special characters directly in the Ruby source code, or read them from 
> an external file (with IO.open).
To display non-ASCII eg accented characters, you need to ensure that the 
string to be displayed is in UTF-8 encoding. wxRuby uses UTF-8 
internally, so a single application can display characters in any 
language for which the user has fonts installed.

I suggest you take a look at the sample text/unicode.rb which shows both 
how to display accented latin and non-Latin characters, and also how to 
use ruby's iconv to convert to and from UTF-8.

hth
alex


More information about the wxruby-users mailing list