1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Shift_JISに変換する際に『 〜 』が化けちゃう【波ダッシュ・全角チルダ問題】

Posted at

解決策

文字列をShift_JISに変換する際 "~"が消える事例に遭遇した人へ
下記のコードを付けよう

# 全角チルダを波ダッシュに変換
.gsub('~', '〜')

原因

上のインライン部分に書いてあるとおり、実は""と""は違う文字

全角チルダ " "はShift_JISにエンコードする際バグってしまうみたい

1
2
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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?