Skip Menu |

This queue is for tickets about the XML-Fast CPAN distribution.

Report information
The Basics
Id: 71532
Status: resolved
Priority: 0/
Queue: XML-Fast

People
Owner: Nobody in particular
Requestors: IKEGAMI [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Bad UTF-8 gives bad scalars.
When provided with invalid UTF-8 (which happens unfortunately often), XML::Fast produces corrupt scalars. $ perl -MXML::Fast -MDevel::Peek -e'Dump(xml2hash(qq{<root>\xB2</root>})->{root});' SV = PV(0x920d7d8) at 0x922a248 REFCNT = 1 FLAGS = (POK,pPOK,UTF8) PV = 0x922e2d8 "\262"\0Malformed UTF-8 character (unexpected continuation byte 0xb2, with no preceding start byte) in subroutine entry at -e line 1. [UTF8 "\x{0}"] CUR = 1 LEN = 12
Scalar is not corrupt. See explanation in #71533
On Sat Oct 15 16:48:32 2011, MONS wrote: Show quoted text
> Scalar is not corrupt. > See explanation in #71533
This is unrelated to #71533. #71533 is about the mishandling of the UTF8 flag on input scalars, and the UTF8 flag isn't set here. In this case, XML::Fast creates a corrupt scalar -- Perl says so itself -- instead of throwing an error when given bad UTF-8.
By default on parsing it just upgrades string to utf8 If somebody needs a sanity check, than utf8decode option may be used: perl -MXML::Fast -MDevel::Peek -E 'Dump xml2hash(qq{<root>\xB2</root>}, utf8decode => 1)->{root};'