I am new to Ruby and writing simple Ruby (without Rails) program, basically just one script file, and seem unable to get user entered Cyrillic text, e.g.
puts gets.chomp
returns ???
instead of жжж
, but works just fine with English letters.
puts gets.chomp.encoding
and ruby -e 'p Encoding.default_external'
return UTF-8
.
On this test
a = gets.chomp
puts a == 'жжж'
puts a == '???'
жжж
input produced
false
true
So they are stored as question marks.
I'm using Windows 10 command prompt (or working in RubyMine, which uses it anyway). Problem persists in pry and irb.
I've tried putting #coding: UTF-8
at the beginning of the source file, didn't help. I've seen advise to edit some configuration files in Ruby on Rails project, but this is not my case.
Is there any simple solution?