Ruby character encoding problems in netabenas and command wíndow
- by salgo60
I use netbeans as development IDE and runs the application from cmd but have problems to display ISO 8859-1 characters like åäö correct in both cmd window and when I run the application from netbeans
Question: What is best practice to set it up
Right now I do
@output.puts indent + "V" + 132.chr + "lkommen till Ruby Camping!"
to get ä
My environment
chcp 65001
Active code page: 65001
ruby main.rb
Source encoding: <Encoding:US-ASCII>
Default external: #<Encoding:UTF-8>
Default internal: nil
Locale charmap: "CP65001"
where I have in the code
def self.printEncoding
puts "Source encoding: #{__ENCODING__.inspect}" if defined? __ENCODING__
if defined? Environment::Encoding
puts "Default external: #{Encoding.default_external.inspect}"
puts "Default internal: #{Encoding.default_internal.inspect}"
puts "Locale charmap: #{ Encoding.locale_charmap.inspect}"
end
puts "LANG environment variable: #{ENV['LANG'].inspect}" unless ENV['LANG'].nil?
end
ruby -v
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32]