A small internationalization issue?

Hi all,

I am a Puerto Rican using Ruby, so the apps I develop are mostly in
Spanish. I am using FXRuby for GUI development (I want to learn wxRuby,
but I can’t find any good tutorials out there). Sometimes, when I
create FXLabels, and have to use Spanish characters like: á é í ó ú,
they don’t display properly on the window. I did a simple test and made
a script with one single line:

puts “á é í ó ú”

When I run this script, the output is:

ß Θ φ ≤ ·

Obviously not what I intended! Funny thing is, when I write that very
same line using irb, the characters display properly.

I think there might be some sort of internationalization issue, perhaps
not even in the language itself.

This is a problem because these characters are sometimes necessary for
words in Spanish, and not using them might mean grammatically incorrect
applications.

Can someone please clarify this for me? Thanks!

On Sun, Jan 3, 2010 at 1:40 PM, tuti plain [email protected]
wrote:

puts “á é í ó ú”

When I run this script, the output is:

ß Θ φ ≤ ·

Can someone please clarify this for me? Â Thanks!

What version of Ruby are you running? What encoding are your files
saved in? We will need to know this in order to be able to help out.

If you’re new to character encodings, in general or just in Ruby, this
series might help:
http://blog.grayproductions.net/categories/character_encodings

-greg

Hi, I am using Ruby 1.8.6, the One Click Installer version, running on
windows 7. I use the scite text editor included with that ruby
distribution. Since I haven’t tampered with the text editor’s encoding
settings, my files are saved in the default, which seems to be “Code
Page Property”.

As a simple test, I changed the encoding to UTF-8 and saved the file.
Now, the editor line looks like this:

puts “E1 E9 ED F3 FA”

But the output is still wrong.

What version of Ruby are you running? What encoding are your files
saved in? We will need to know this in order to be able to help out.

If you’re new to character encodings, in general or just in Ruby, this
series might help:
http://blog.grayproductions.net/categories/character_encodings

-greg

On Sun, Jan 3, 2010 at 8:07 PM, tuti plain [email protected]
wrote:

puts “E1 E9 ED F3 FA”

But the output is still wrong.

If you’re using Ruby 1.8.6, be sure to set $KCODE=“U”

-greg

If you’re using Ruby 1.8.6, be sure to set $KCODE=“U”

Hi thanks for your reply. Sorry I took so long to reply. I tried what
you said, but it didn’t work either. I still see incorrect characters.
What else can I try?

On Mon, Jan 11, 2010 at 7:44 AM, tuti plain [email protected]
wrote:

If you’re using Ruby 1.8.6, be sure to set $KCODE=“U”

Hi thanks for your reply. Sorry I took so long to reply. I tried what
you said, but it didn’t work either. I still see incorrect characters.
What else can I try?

It’s possible that you’re using a terminal that doesn’t play nice with
UTF-8 characters. Check your terminal settings.

-greg