문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top