Last Updated: May 15, 2019
·
2.884K
· bartlomiejdanek

Force UTF-8 encoding for all Ruby 1.9 stuff

When you get some wired errors with encoding, for instance

Encoding::InvalidByteSequenceError: "\xC3" on US-ASCII

You can force Ruby to use UTF-8 encoding by:

export RUBYOPT=-Ku

After that you should restart your application.
I suggest to add this line into environment/profile or your shell config file.

echo "export RUBYOPT=-Ku" > /etc/profile

2 Responses
Add your response

Be aware that -Ku has been deprecated for a while, around some versions of 1.9.3 and is not recognized at in 2.0.

over 1 year ago ·

Good to know! Thanks for your comment!

over 1 year ago ·