Your message dated Wed, 16 Dec 2015 22:18:22 +0000
with message-id <[email protected]>
and subject line Bug#798727: fixed in perl 5.22.1-1
has caused the Debian Bug report #798727,
regarding Encode::Unicode decode() dies unnecessarily
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
798727: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=798727
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: perl
Version: 5.20.2-2

The Encode::Unicode documentation states the following:

When BE or LE is omitted during decode(), it checks if BOM is at the
beginning of the string; if one is found, the endianness is set to what
the BOM says. If no BOM is found, the routine dies.

To reproduce:
---
use Encode qw/decode/;
decode("utf-16be", "Hello World"); # does not die
decode("utf-16le", "Hello World"); # does not die
decode("utf-16", "\xFE\xFFHello World"); # does not die
decode("utf-16", "Hello World"); # dies with "UTF-16:Unrecognised BOM"
---

Unicode Standard version 8.0:

The UTF-16 encoding scheme may or may not begin with a BOM. However,
when there is no BOM, and in the absence of a higher-level protocol, the
byte order of the UTF-16 encoding scheme is big-endian.

RFC2781:

If the first two octets of the text is not 0xFE followed by
0xFF, and is not 0xFF followed by 0xFE, then the text SHOULD be
interpreted as being big-endian.

There is a simple fix of doing nothing:

diff --git a/cpan/Encode/Unicode/Unicode.xs b/cpan/Encode/Unicode/Unicode.xs
index cf42ab8..7caf1c1 100644
--- a/cpan/Encode/Unicode/Unicode.xs
+++ b/cpan/Encode/Unicode/Unicode.xs
@@ -164,9 +164,18 @@ CODE:
                endian = 'V';
            }
            else {
-               croak("%"SVf":Unrecognised BOM %"UVxf,
-                     *hv_fetch((HV *)SvRV(obj),"Name",4,0),
-                     bom);
+               /* No BOM found, use big-endian fallback as specified in
+                * RFC2781 and the Unicode Standard version 8.0:
+                *
+                *  The UTF-16 encoding scheme may or may not begin with
+                *  a BOM. However, when there is no BOM, and in the
+                *  absence of a higher-level protocol, the byte order
+                *  of the UTF-16 encoding scheme is big-endian.
+                *
+                *  If the first two octets of the text is not 0xFE
+                *  followed by 0xFF, and is not 0xFF followed by 0xFE,
+                *  then the text SHOULD be interpreted as big-endian.
+                */
            }
        }
 #if 1

CPAN bug report: https://rt.cpan.org/Ticket/Display.html?id=107043

--- End Message ---
--- Begin Message ---
Source: perl
Source-Version: 5.22.1-1

We believe that the bug you reported is fixed in the latest version of
perl, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Niko Tyni <[email protected]> (supplier of updated perl package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Wed, 16 Dec 2015 20:13:17 +0200
Source: perl
Binary: perl-base perl-doc perl-debug libperl5.22 libperl-dev perl-modules-5.22 
perl
Architecture: source
Version: 5.22.1-1
Distribution: unstable
Urgency: low
Maintainer: Niko Tyni <[email protected]>
Changed-By: Niko Tyni <[email protected]>
Description:
 libperl-dev - Perl library: development files
 libperl5.22 - shared Perl library
 perl       - Larry Wall's Practical Extraction and Report Language
 perl-base  - minimal Perl system
 perl-debug - debug-enabled Perl interpreter
 perl-doc   - Perl documentation
 perl-modules-5.22 - Core Perl modules
Closes: 798727
Changes:
 perl (5.22.1-1) unstable; urgency=low
 .
   * New upstream release.
   * Backport Encode::Unicode BOM fix from Encode-2.77.
     (Closes: #798727)
     + break+replace libencode-perl (<< 2.77) accordingly
   * Upload to unstable.
     + drop perlapi-5.22.0 for transition purposes
Checksums-Sha1:
 568ab6c96f8e11b19102f2864ee6cda4ea1528da 2317 perl_5.22.1-1.dsc
 8cb3b099f7c74d4f541a9318c108906daef942c1 11223940 perl_5.22.1.orig.tar.xz
 609d57da819a6a2dbe7d61c05a0aeace95db275c 111416 perl_5.22.1-1.debian.tar.xz
Checksums-Sha256:
 2c0f11b3d70ebd8bd7dc3982a8e53154b3c48b733fbf260ceefe9fb06fe7a55d 2317 
perl_5.22.1-1.dsc
 9e87317d693ce828095204be0d09af8d60b8785533fadea1a82b6f0e071e5c79 11223940 
perl_5.22.1.orig.tar.xz
 14426645c5afed1ca6810980af0563f5873e283c9e88379170d8fa0eec624db8 111416 
perl_5.22.1-1.debian.tar.xz
Files:
 6433deba55cca13394876b549cbe74f1 2317 perl standard perl_5.22.1-1.dsc
 6671e4829cbaf9cecafa9a84f141b0a3 11223940 perl standard perl_5.22.1.orig.tar.xz
 8491f7f79027966873f65d502b3461ed 111416 perl standard 
perl_5.22.1-1.debian.tar.xz

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJWccS6AAoJEC7A/7O3MBsfMu4P/2CI6+9uGWwc/OMEC91UHJHP
t4gyNLLlQ21o1S5QbMt9temV9RBAc93WX42jalEqUU+GXLnpIVWGl1r9DLPVQX9l
4HyENBHa54UrRK9Msv1QHu/fIjQ+dTHrKK1UVh5EUIgNnEZTJC3ND5LMOvMJdpu/
3HIcwivpydrjVSPzF3nPnd2fwXNlsY5nfhAqd5qYZBviN+lWdPAJ56mwsHbL1dt+
+MhiVo57VkSA5oDvOn2TA3Q0fKFwBf0YNPFPUjWN2sTcgYvn9H/k+FJ8RfKAUmrG
hm5Jv3JTmKCKO1k59hK61Kl2B0peQyzLvUNZWDW30+uLd/rh6Dq+3CGirr+4ygA9
QQPgv9d/rvgxvI0oLudHLHoOjzSzIvRHy9x5vQVH9XYtdR0ug1FStqBK3bJnkccb
BXDQ5PkHVLUpvsDn4jjxTZUAWbuIliXjJHlRjZcqOcOdR1LG7STTz5o8Tfxipzn4
lmMuaLTZOxe6GE5W20uyVmKYtVteSpweTc3tyId28PiuWs5IGpBUAjYnLrumNmSy
WTQisKeUAawjRoqpyeqqLB95UVQv4PFMu6dfs0+lTXUCwddxRO6UlNGtLYqLVqwO
ruzDmuduXobht6m46FefAb5ARjq5PwNU6/VWFdHcIn/SeI0quJNdXjxj8xwvoyfb
qbK5iBcSccqEf+W4OhgR
=S9V3
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to