LoginSignup
25
23

More than 5 years have passed since last update.

Rubyで日本語が8bit asciiになってしまう場合

Posted at

こんな感じのやつ
\xE3\x81\x99\xE3\x82\x82\xE3\x82\x82

標準出力が文字化けする場合
pではなくputsかprintを使う

正規表現とかがヒットしなくてこんなエラーが出る場合
incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string) (Encoding::CompatibilityError)

String.force_encoding("UTF-8")を使う

25
23
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
25
23