石田と申します。

NKFで"−"(Unicode 0xff0d)のコード変換がおかしいです。
誰か修正していただけませんか?
よろしくおねがいします。


# test02.rb
# -*- coding: utf-8 -*-
require 'nkf'

def codepoint(str)
str.each_codepoint {|cp| print "U+#{cp.to_s(16)} " }
print "\n"
end

utf8 = "!#$%&()*+,−./"
codepoint(utf8)

utf16le = NKF.nkf("--ic=UTF-8 --oc=UTF-16LE", utf8 )
codepoint(utf16le)

puts "------------"
utf16le_2 = "!#$%&()*+,−./".encode("UTF-16LE")
codepoint(utf16le_2)

utf8_2 = NKF.nkf("--ic=UTF-16LE --oc=UTF-8", utf16le_2 )
codepoint(utf8_2)


$ ruby test02.rb
U+ff01 U+ff02 U+ff03 U+ff04 U+ff05 U+ff06 U+ff07 U+ff08 U+ff09 U+ff0a
U+ff0b U+ff0c U+ff0d U+ff0e U+ff0f
U+ff01 U+ff02 U+ff03 U+ff04 U+ff05 U+ff06 U+ff07 U+ff08 U+ff09 U+ff0a
U+ff0b U+ff0c U+2212 U+ff0e U+ff0f
------------
U+ff01 U+ff02 U+ff03 U+ff04 U+ff05 U+ff06 U+ff07 U+ff08 U+ff09 U+ff0a
U+ff0b U+ff0c U+ff0d U+ff0e U+ff0f
U+ff01 U+ff02 U+ff03 U+ff04 U+ff05 U+ff06 U+ff07 U+ff08 U+ff09 U+ff0a
U+ff0b U+ff0c U+2212 U+ff0e U+ff0f


下記のバージョンで確認しました。
$ ruby -v
ruby 1.9.3p392 (2013-02-22) [i386-mingw32]

$ ruby -v
ruby 2.0.0p0 (2013-02-24) [i386-mingw32]