Project

General

Profile

Actions

Bug #12052

closed

String#encode with xml option returns wrong result for totally non-ASCII-compatible encodings

Added by nobu (Nobuyoshi Nakada) about 8 years ago. Updated over 2 years ago.

Status:
Closed
Target version:
-
ruby -v:
[ruby-dev:49493]

Description

String#encodeをASCII非互換エンコーディングから同じエンコーディングへ、xml:オプション付きで呼ぶとおかしな結果を返します。
バイナリとして変換してしまっているようです。

p "<\0>\0".encode("utf-16le", "utf-16le", xml: :text)
#=> "\u6C26\u3B74\u2600\u7467;"
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0