Skip Menu |

This queue is for tickets about the Encode-IMAPUTF7 CPAN distribution.

Report information
The Basics
Id: 45050
Status: resolved
Priority: 0/
Queue: Encode-IMAPUTF7

People
Owner: Nobody in particular
Requestors: nick [...] packetfrenzy.com
Cc:
AdminCc:

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



Subject: [Fwd: IMAPUTF7 patch]
Date: Tue, 14 Apr 2009 20:39:17 -0700
To: bug-encode-imaputf7 [...] rt.cpan.org
From: Nick Czeczulin <nick [...] packetfrenzy.com>
Subject: IMAPUTF7 patch
Date: Fri, 10 Apr 2009 21:11:29 -0700
To: peter [...] makholm.net
From: Nick Czeczulin <nick [...] packetfrenzy.com>
Hi Peter, My apologies for not using rt, but I do not have a registered account. Two minor changes: 1. Changed to use ascii ranges to explicitly match the rfc. One of the flaws with the current module is \r\n\t should be encoded. 2. The other thing I noticed is if you have an '&' following a non-printable character it will get base64 encoded as well. Thanks for maintaining this module. Cheers! -nick
--- IMAPUTF7.pm 2009-04-10 20:24:04.000000000 -0700 +++ IMAPUTF7-new.pm 2009-04-10 20:56:38.000000000 -0700 @@ -15,11 +15,8 @@ # Code directly borrowed from Encode::Unicode::UTF7 by Dan Kogai # -my $specials = quotemeta "!\"#$%'()*+,-./:;<=>?@[\\]^_`{|}~"; -# \s will not work because it matches U+3000 DEOGRAPHIC SPACE -# We use qr/[\n\r\t\ ] instead -my $re_asis = qr/(?:[\n\r\t\ A-Za-z0-9$specials])/; -my $re_encoded = qr/(?:[^\n\r\t\ A-Za-z0-9$specials])/; +my $re_asis = qr/(?:[\x20-\x25\x27-\x7e])/; +my $re_encoded = qr/(?:[^\x20-\x7e])/; my $e_utf16 = find_encoding("UTF-16BE"); sub needs_lines { 1 }; @@ -32,16 +29,15 @@ while (pos($str) < $len){ if ($str =~ /\G($re_asis+)/ogc){ $bytes .= $1; + }elsif($str =~ /\G&/ogc) + { + $bytes .= "&-"; }elsif($str =~ /\G($re_encoded+)/ogsc){ - if ($1 eq "&"){ - $bytes .= "&-"; - }else{ - my $s = $1; + my $s = $1; my $base64 = encode_base64($e_utf16->encode($s), ''); $base64 =~ s/=+$//; $base64 =~ s/\//,/g; $bytes .= "&$base64-"; - } }else{ die "This should not happen! (pos=" . pos($str) . ")"; }
I've commited you patch and released the new version as 1.02.
On Mon Apr 20 09:55:41 2009, pmakholm wrote: Show quoted text
> I've commited you patch and released the new version as 1.02.
1.02 is not the patch that I submitted. Please remove my name from the 1.02 revision history and update the change log appropriately. Thank you.
You name has been removed fra changelog.