1
0

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.

『 SJIS is Windows-31J 』検証 - Ruby 1.9.3p0

Last updated at Posted at 2012-03-16

!! コードが表示されないのでpastebinに書いた !!
!! 文字コードがCP932だと、もしかしてダメ? !!

おー、Encoding::UndefinedConversionErrorがでない。
EmEditorも『# coding: SJIS』よるエンコード検出機能が動くようになった。

OS: Windows XP SP3

# coding: SJIS
# ruby 1.9.3p0 (2011-10-30) [i386-mingw32]

puts "8160:WAVE DASH            " << "~".encode("CP932").prepend("[ ").concat(" ]")
puts "8161:DOUBLE VERTICAL LINE " << "∥".encode("CP932").prepend("[ ").concat(" ]")
puts "817C:MINUS SIGN           " << "-".encode("CP932").prepend("[ ").concat(" ]")
puts "8191:CENT SIGN            " << "¢".encode("CP932").prepend("[ ").concat(" ]")
puts "8192:POUND SIGN           " << "£".encode("CP932").prepend("[ ").concat(" ]")
puts "81CA:NOT SIGN             " << "¬".encode("CP932").prepend("[ ").concat(" ]")
# => 8160:WAVE DASH            [ ~ ]
# => 8161:DOUBLE VERTICAL LINE [ ∥ ]
# => 817C:MINUS SIGN           [ - ]
# => 8191:CENT SIGN            [ ¢ ]
# => 8192:POUND SIGN           [ £ ]
# => 81CA:NOT SIGN             [ ¬ ]

1
0
1

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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?