Access to display characters such as [äöüßÄÖÜß] (utf-8 encoding)? (Perhaps a problem with Windows specifics?)

[All scripts that I work with these German characters are in UTF-8 itself, have #encoding: utf-8 at the top (and Encoding.external_default = 'utf-8' , and not that which is really relevant, because German characters in lines that are defined in the script are not displayed correctly.)]

All of these things are perfectly displayed on the Windows command line and use irb, etc.

I can’t even enter these characters in the prompt. An attempt to insert puts "äöüÄÖÜß" inserted by puts " . An attempt to actually enter them freezes somehow, and I have to ^ D exit.

Using pry, I ran a script with GC = "äöüÄÖÜß" in it, and this is the kind of garbledeegook I get:

 [1] pry(main)> GC => "├ñ├Â├╝├ä├û├£├ƒ" [2] pry(main)> GC.split('').each{ |c| puts c } ├ñ ├ ├╝ ├ä ├û ├£ ├ƒ => ["├ñ", "├Â", "├╝", "├ä", "├û", "├£", "├ƒ"] [3] pry(main)> File.open("output.txt", 'w'){|f| GC.split('').each{ |c| f.puts c } } 

However, the test file output.txt created by this last line is in utf-8 and reads:

 ä ö ü Ä Ö Ü ß 

Does anyone have any ideas how to fix this?

+4
source share
1 answer

I know that if you install Ruby with readline support, you do not have this problem. To do this, you will need something like this if you are using rbenv (with ruby-build):

 RUBY_CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline`" rbenv install 1.9.3 

I do not know if there are other solutions.

+3
source

All Articles