Skip Menu |

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

Report information
The Basics
Id: 25167
Status: open
Priority: 0/
Queue: MKDoc-XML

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

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



Subject: Patch for Decode::Numeric
Similar to the patch for XHTML. I found that mixing the entity and numeric chars would cause problems in output. Applying this patch resolves those issues.
Subject: Numeric.pm.diff
--- Numeric.pm 2003-12-10 10:52:13.000000000 -0500 +++ /home/william/work/perl/Knowmad-Mailform/perl5/MKDoc/XML/Decode/Numeric.pm 2007-02-27 02:40:13.000000000 -0500 @@ -1,6 +1,7 @@ package MKDoc::XML::Decode::Numeric; use warnings; use strict; +use Encode; sub process { @@ -13,9 +14,14 @@ # if hex, convert to hex $stuff =~ s/^\[xX]([0-9a-fA-F])+$/hex($1)/e; - return unless ($stuff =~ /^\d+$/); - return chr ($stuff); + + + # Encode + my $chr = chr($stuff); + $chr = Encode::encode_utf8($chr); + $chr = pack("U*", unpack("C*", $chr)); + return $chr; } 1;
FYI, it looks like the pack command is unnecessary. I though it fixed chars that are greater than 255 (e.g., mdash) but further testing reveals that the encode_utf8 works fine. Interestingly the pack command works for chars > 255 but not less than (e.g., nbsp).