A small internationalization issue?

T

tuti plain

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!
 
G

Gregory Brown

puts "=C3=A1 =C3=A9 =C3=AD =C3=B3 =C3=BA"

When I run this script, the output is:

=C3=9F =CE=98 =CF=86 =E2=89=A4 =C2=B7
Can someone please clarify this for me? =C2=A0Thanks!

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
 
T

tuti plain

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.
 
T

tuti plain

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?
 
G

Gregory Brown

Hi thanks for your reply. =A0Sorry I took so long to reply. =A0I tried wh= at
you said, but it didn't work either. =A0I 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top