Please don't forget in addition, that Windows uses two different 
encodings internally. You will see this when typing "äöü" using a 
windows editor and listing the file using "type" in a windows console, 
which will then produce...

C:\Dokumente und Einstellungen\wolfgang\Desktop>type umlaute.txt
õ÷³

...as output. This has the additional effect, that using Umlaute in 
strings in "irb" and writing this texts to a file...

C:\Dokumente und Einstellungen\wolfgang\Desktop>irb
irb(main):001:0> File.open('umlautausgabe.txt', 'w') do |f|
irb(main):002:1*   f.print 'äöü'
irb(main):003:1> end
=> nil
irb(main):004:0> exit

...will produce a file with some unreadable data, when opened with the 
Windows editor...

¡É

In addition you will not be able to output utf-8 encoded data on a 
Windows console (except those character, that are ASCII) in a correct 
way.

To use utf-8 encoded constants in Ruby programms is easy - you need to 
edit the data in utf-8 format by an editor. Unfortunately you need a 
"magic line" on Windows for Ruby 1.8. utf-8 encoded data usually has a 
BOM at the beginning of a file, which will not be ignored in Ruby 1.8. 
You must start a program with a line like...

=nil

...to avoid this, and then start your Ruby program using...

ruby -Ku programfile.rb

In addition you should know, that Ruby 1.8 doesn't support utf-8 
encoding in class String (there are existing extensions for that 
purpose), so String handling is still based on bytes.

This did change completely for Ruby 1.9, where utf-8 support it 
embedded.

Wolfgang Nádasi-Donner
-- 
Posted via http://www.ruby-forum.com/.