Skip Menu |

This queue is for tickets about the Encode CPAN distribution.

Report information
The Basics
Id: 8694
Status: resolved
Priority: 0/
Queue: Encode

People
Owner: DANKOGAI [...] cpan.org
Requestors: GAAS [...] cpan.org
Cc:
AdminCc:

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



Subject: FB_HTMLCREF and FB_XMLCREF for the UTF-8 decoder
The following patch to Encode-2.08 seems to fix this. There was even prepared tests for this :)
diff -ru Encode-2.08/Encode.xs Encode-2.08-hacked/Encode.xs --- Encode-2.08/Encode.xs 2004-10-24 15:00:33.000000000 +0200 +++ Encode-2.08-hacked/Encode.xs 2004-12-01 18:32:08.818467762 +0100 @@ -331,7 +331,9 @@ break; } if (check & (ENCODE_PERLQQ|ENCODE_HTMLCREF|ENCODE_XMLCREF)){ - SV* subchar = newSVpvf("\\x%02" UVXf, (UV)*s); + SV* subchar = newSVpvf(check & ENCODE_PERLQQ ? "\\x%02" UVXf : + check & ENCODE_HTMLCREF ? "&#%" UVuf ";" : + "&#x%" UVxf ";", (UV)*s); sv_catsv(dst, subchar); SvREFCNT_dec(subchar); } else { diff -ru Encode-2.08/t/fallback.t Encode-2.08-hacked/t/fallback.t --- Encode-2.08/t/fallback.t 2004-10-22 21:15:03.000000000 +0200 +++ Encode-2.08-hacked/t/fallback.t 2004-12-01 18:26:39.236376790 +0100 @@ -17,7 +17,7 @@ use strict; #use Test::More qw(no_plan); -use Test::More tests => 36; +use Test::More tests => 40; use Encode q(:all); my $uo = ''; @@ -137,17 +137,17 @@ is($dst, $ah, "FB_HTMLCREF ascii"); is($src, '', "FB_HTMLCREF residue ascii"); -#$src = $ao; -#$dst = $utf8->decode($src, FB_HTMLCREF); -#is($dst, $uh, "FB_HTMLCREF utf8"); -#is($src, '', "FB_HTMLCREF residue utf8"); +$src = $ao; +$dst = $utf8->decode($src, FB_HTMLCREF); +is($dst, $uh, "FB_HTMLCREF utf8"); +is($src, '', "FB_HTMLCREF residue utf8"); $src = $uo; $dst = $ascii->encode($src, FB_XMLCREF); is($dst, $ax, "FB_XMLCREF ascii"); is($src, '', "FB_XMLCREF residue ascii"); -#$src = $ao; -#$dst = $utf8->decode($src, FB_XMLCREF); -#is($dst, $ax, "FB_XMLCREF utf8"); -#is($src, '', "FB_XMLCREF residue utf8"); +$src = $ao; +$dst = $utf8->decode($src, FB_XMLCREF); +is($dst, $ax, "FB_XMLCREF utf8"); +is($src, '', "FB_XMLCREF residue utf8");