Skip Menu |
 

This queue is for tickets about the Encode CPAN distribution.

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

People
Owner: Nobody in particular
Requestors: fbriere [...] fbriere.net
Cc:
AdminCc:

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



Subject: Support for RFC 2184 language tag
Download (untitled) / with headers
text/plain 281b
Here's a patch that adds decoding support for language tags, as defined in RFC 2184. Currently, MIME/Header.pm will refuse to decode any encoded-word bearing a language tag. (I purposedly left the second RE looser than the first, since it can't hurt to be liberal when encoding.)
Download rfc2184.patch
text/x-diff 993b
--- /usr/share/perl/5.8/Encode/MIME/Header.pm 2005-11-12 21:42:49.000000000 -0500 +++ t/lib/Encode/MIME/Header.pm 2005-12-02 12:32:34.000000000 -0500 @@ -51,6 +51,7 @@ s{ =\? # begin encoded word ([0-9A-Za-z\-_]+) # charset (encoding) + (?:\*[A-Za-z]{1,8}(?:-[A-Za-z]{1,8})*)? # language (RFC 2184) \?([QqBb])\? # delimiter (.*?) # Base64-encodede contents \?= # end encoded word @@ -96,6 +97,7 @@ (?: =\? # begin encoded word (?:[0-9A-Za-z\-_]+) # charset (encoding) + (?:\*\w+(?:-\w+)*)? # language (RFC 2184) \?(?:[QqBb])\? # delimiter (?:.*?) # Base64-encodede contents \?= # end encoded word
Subject: Support for RFC 2231 language tag
From: Frédéric Brière <fbriere [...] fbriere.net>
Download (untitled) / with headers
text/plain 213b
Here's an updated patch that: a) Includes a test in t/mime-header.t b) Applies to the root of the distribution (instead of wherever I made the first patch) c) Refers to RFC 2231, which obsoleted RFC 2184 Enjoy!
Download rfc2231.patch
text/x-diff 2.4k
diff -ruN Encode-2.12.orig/lib/Encode/MIME/Header.pm Encode-2.12/lib/Encode/MIME/Header.pm --- Encode-2.12.orig/lib/Encode/MIME/Header.pm 2005-09-08 10:17:32.000000000 -0400 +++ Encode-2.12/lib/Encode/MIME/Header.pm 2005-12-02 22:18:34.000000000 -0500 @@ -51,6 +51,7 @@ s{ =\? # begin encoded word ([0-9A-Za-z\-_]+) # charset (encoding) + (?:\*[A-Za-z]{1,8}(?:-[A-Za-z]{1,8})*)? # language (RFC 2231) \?([QqBb])\? # delimiter (.*?) # Base64-encodede contents \?= # end encoded word @@ -96,6 +97,7 @@ (?: =\? # begin encoded word (?:[0-9A-Za-z\-_]+) # charset (encoding) + (?:\*\w+(?:-\w+)*)? # language (RFC 2231) \?(?:[QqBb])\? # delimiter (?:.*?) # Base64-encodede contents \?= # end encoded word diff -ruN Encode-2.12.orig/t/mime-header.t Encode-2.12/t/mime-header.t --- Encode-2.12.orig/t/mime-header.t 2005-09-08 10:17:34.000000000 -0400 +++ Encode-2.12/t/mime-header.t 2005-12-02 22:32:35.000000000 -0500 @@ -23,7 +23,7 @@ use strict; #use Test::More qw(no_plan); -use Test::More tests => 10; +use Test::More tests => 11; use_ok("Encode::MIME::Header"); my $eheader =<<'EOS'; @@ -55,6 +55,16 @@ is(Encode::decode('MIME-Header', $uheader), $dheader, "decode UTF-8 (RFC2047)"); +my $lheader =<<'EOS'; +From: =?US-ASCII*en-US?Q?Keith_Moore?= <moore@cs.utk.edu> +To: =?ISO-8859-1*da-DK?Q?Keld_J=F8rn_Simonsen?= <keld@dkuug.dk> +CC: =?ISO-8859-1*fr-BE?Q?Andr=E9?= Pirard <PIRARD@vm1.ulg.ac.be> +Subject: =?ISO-8859-1*en?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?= + =?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?= +EOS + +is(Encode::decode('MIME-Header', $lheader), $dheader, "decode language tag (RFC2231)"); + $dheader=<<'EOS'; From: 小飼 弾 <dankogai@dan.co.jp>
Download (untitled) / with headers
text/plain 317b
On Fri Dec 02 22:41:43 2005, FBRIERE wrote: Show quoted text
> Here's an updated patch that: > > a) Includes a test in t/mime-header.t > b) Applies to the root of the distribution (instead of wherever I made > the first patch) > c) Refers to RFC 2231, which obsoleted RFC 2184 > > Enjoy!
Thanks, applied. Dan the Encode Maintainer


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.