Question

I had a Ruby script giving me an invalid multibyte char (US-ASCII) error. It turns out the server's $LANG env variable was not being set. Once I set it to en_US.UTF-8, the error went away.

Does this mean export LANG="en_US.UTF-8" is equivalent to putting # encoding: UTF-8 on every file?

Was it helpful?

Solution

No, unless I'm mistaken, setting:

# encoding: UTF-8

Only sets the source encoding for that file.

Setting:

export LANG="en_US.UTF-8"

Only sets the default external encoding.

Ruby 1.9 has internal, source, and external encodings.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top