Skip to content

Instantly share code, notes, and snippets.

@aileron
Created August 20, 2012 07:59
Show Gist options
  • Save aileron/3402037 to your computer and use it in GitHub Desktop.
Save aileron/3402037 to your computer and use it in GitHub Desktop.
Ruby1.9 で Shift_JIS 風 UTF-8 と CP932 風 UTF-8 の正規化
# ruby1.9 で正規化して、エンコードするまで
"なんかきもいやつら".
tr("\u{301C 2016 2212 00A2 00A3 00AC 2014 00A6}","\u{FF5E 2225 FF0D FFE0 FFE1 FFE2 2015 FFE4}").encode("sjis")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment