Output problem with accented characters

Hi,

I don’t know what is happening. Imagine this simple program that just prints
something to the console:

print “Isto é texto com carateres acentuados: áãçõúé”

If I use irb everything goes ok. But if I save this as a text file, ex:
test.rb and run it through the ruby interpreter it prints garbage in place
of the accented caracters. How can I have the correct caracters printed ?

Using Ruby 1.8.1, mswin32 build, Windows XP english, portuguese keyboard.

Thanks

Hi!

  • Luis Paulo Oliveira:

print “Isto é texto com carateres acentuados: áãçõúé”

If I use irb everything goes ok. But if I save this as a text file,
ex: test.rb and run it through the ruby interpreter it prints
garbage in place of the accented caracters. How can I have the
correct caracters printed ?

Sounds familiar even though I have not been using Windows for quite a
long time:

If you see a lowercase beta, lowercase pi, lowercase gamma, lower
part of integral symbol, centered dot an lowercase theta the problem
is that that the console uses Codepage 865 while the GUI uses
codepage 1252.

Find an editor that is capable of saving the file in cp 865 or a
conversion tool or simply used ‘edit’ to write the program :->

Josef ‘Jupp’ SCHUGT

···


http://oss.erdfunkstelle.de/ruby/ - German comp.lang.ruby-FAQ
http://rubyforge.org/users/jupp/ - Ruby projects at Rubyforge
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Germany 2004: To boldly spy where no GESTAPO / STASI has spied before