Choice of BOM for UTF-16 encoding
[email protected] (Geoffrey Leach) Sun, 09 Feb 2014 15:59:30 -0800
| Newsgroups | perl.unicode |
|---|---|
| Message-ID | <[email protected]> |
--=-Jczaa+kJV53ugoNcMn4V
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
I'm the maintainer of Audio::Taglib.=20
Summary of my perl5 (revision 5 version 16 subversion 3) configuration:
osname=3Dlinux, osvers=3D3.10.9-200.fc19.x86_64, archname=3Dx86_64-linu=
x-thread-multi
=20
$utf16 =3D encode("UTF-16", "\x{6211}\x{7684}") prepends a big-endian BOM. =
As best I can tell this results from U8 endian =3D *((U8 *)SvPV_nolen(attr(=
"endian", 6))); in Unicode/Unicode.xs returning null in Unicode/Unicode.xs
I presume this is what's intended. Is there a way to force (from my module)=
the choice to be LE? It turns out that the library I'm supporting (taglib)=
works in LE.
Testcase attached.
Thanks.=
--=-Jczaa+kJV53ugoNcMn4V
Content-Type: application/x-perl; name=encode-test.pl
Content-Disposition: attachment; filename=encode-test.pl
Content-Transfer-Encoding: base64
IyEvdXNyL2Jpbi9wZXJsIAoKdXNlIEVuY29kZSBxdyhlbmNvZGUgKTsKCnN1YiBkIHsKICAgICgk
biwgJGMpID0gQF87CiAgICAkbCA9IGxlbmd0aCgkYyk7CiAgICAkaSA9IDA7CiAgICBwcmludGYg
IiU4czogIiwgJG47CiAgICB3aGlsZSAoICRpIDwgJGwgKSB7CiAgICAgICAgJGNoID0gdmVjKCRj
LCAkaSwgOCk7CiAgICAgICAgcHJpbnRmICIlMDJ4IiwgICRjaDsKICAgICAgICAkaSsrOwogICAg
ICAgIHByaW50ICcgJyB1bmxlc3MgJGkgJiAxOwogICAgfQogICAgcHJpbnQgIlxuIjsKfQoKJHV0
ZjE2ID0gZW5jb2RlKCJVVEYtMTYiLCAiXHh7NjIxMX1ceHs3Njg0fSIpOwpkKCd1dGYxNicsICR1
dGYxNik7Cgo=
--=-Jczaa+kJV53ugoNcMn4V--