From: Chris Lervag Date: 2011-12-15T19:13:47+09:00 Subject: Encoding woes with command promt output Im working on a script which is going to be printing some non-ascii characters (æøå), and for the life of me, I just cant seem to make it print in the Windows Command Prompt terminal! I think I have done what should be enough to make it work, defining the encoding in my ruby file, but it just isnt working. However, if I try to print the same characters in irb, it works just fine. I can make it work by injecting hex values in my strings, but Id rather not have to do that, as that code isnt very readable. Im at a loss here, and would be grateful if anyone can help me out with my encoding woes! OS: Windows XP 32 bit SP3 C:\>ruby -v ruby 1.9.2p180 (2011-02-18) [i386-mingw32] Content in file test.rb: # Encoding: CP850 puts "æøå" puts "\x91\x9B\x86" puts Encoding.default_external C:\>ruby test.rb ├ª├©├Ñ æøå CP850 C:\>irb irb(main):001:0> puts "æøå" æøå => nil irb(main):002:0> puts "\x91\x9B\x86" æøå => nil irb(main):003:0> puts Encoding.default_external CP850 Regards, Chris -- Posted via http://www.ruby-forum.com/.