LoginSignup
8
7

More than 5 years have passed since last update.

DockerHub公式RubyイメージでInvalid Byte Sequenceが出る場合の対処法

Posted at

DockerHubの公式Rubyイメージ上で、UTF-8の文字列を読み込んだ場合、Invalid Byte Sequenceエラーが出る。外部エンコーディングがASCIIになっているからなのだが、LANGLC_ALLen_US.UTF-8をセットしても有効にならない。
$ locale -aで確認したところ、C.UTF-8のみUTF-8が有効になっていたので、LANGC.UTF-8をセットしてやればよい。

$ LANG=C.UTF-8 ruby -e "p Encoding.default_external"
8
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
7