Actions
Bug #9415
closedStrings#codepoints doesn't respect BOM on UTF-{16,32} pseudo encodings
Bug #9415:
Strings#codepoints doesn't respect BOM on UTF-{16,32} pseudo encodings
ruby -v:
-
Description
String#codepoints
がUTF-16
、UTF-32
でのBOMを考慮していません。
$ ruby -e 'puts "%x" % "\u{feff}".encode("UTF-16BE").force_encoding("UTF-16").codepoints'
feff
$ ruby -e 'puts "%x" % "\u{feff}".encode("UTF-16LE").force_encoding("UTF-16").codepoints'
fffe
String#ord
なども同様です。
$ ruby -e 'printf "%x\n", "\u{feff}".encode("UTF-16BE").force_encoding("UTF-16").ord'
feff
$ ruby -e 'printf "%x\n", "\u{feff}".encode("UTF-16LE").force_encoding("UTF-16").ord'
fffe
Actions