Project

General

Profile

Actions

Bug #9415

closed

Strings#codepoints doesn't respect BOM on UTF-{16,32} pseudo encodings

Added by nobu (Nobuyoshi Nakada) almost 11 years ago. Updated almost 11 years ago.

Status:
Closed
Target version:
[ruby-dev:<unknown>]

Description

String#codepointsUTF-16UTF-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

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #8940: printing UTF-32 crashs rubyClosed09/23/2013Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0