Subject: | Support for RFC 2184 language tag |
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.)
--- /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