25
23

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?