Reputation: 309
I stopped program with pry, then I type
[1] pry(Module1::Class1)> Encoding.default_external
=> #<Encoding:Windows-1252>
In another mac, default value of Encoding.default_external
is UTF-8. I changed locale variables to UTF-8, and encoding in irb works fine, but not in project stopped. With byebug is the same.
System is macOSX, ruby 2.3.3 through rbenv.
Upvotes: 0
Views: 759
Reputation: 8637
You can use the LANG
env variable to influence the default external encoding:
ruby-2.3.4 Desktop$ LANG=en_US.US-ASCII irb
2.3.4 :001 > Encoding.default_external
=> #<Encoding:US-ASCII>
ruby-2.3.4 Desktop$ LANG=de_CH.UTF-8 irb
2.3.4 :001 > Encoding.default_external
=> #<Encoding:UTF-8>
it is also possible to override it with the -E
options:
ruby-2.3.4 Desktop$ LANG=en_US.US-ASCII irb -E utf-8
2.3.4 :001 > Encoding.default_external
=> #<Encoding:UTF-8>
Upvotes: 2