perl-unicode

Bug in Encode::encode("MIME-Q", $string)

2004-02-18 09:30:04
Hello,

the following example code produces a wrong RFC2047 encoded string:

use Encode qw(encode);
my $string = Encode::encode("UTF-8", "ääääääääääääääääääääääääääääääääääää");
print Encode::encode("MIME-Q", $string), "\n";

The output is:

=?UTF-8?Q?=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3?=
 =?UTF-8?Q?=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4?=
 =?UTF-8?Q?=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3?=
 =?UTF-8?Q?=A4=C3=A4=C3=A4=C3=A4=C3=A4?=
 
RFC 2047 states:

A multi-octet character may not be split across adjacent 'encoded-word's.

So there must not be a line break after =C3 in the first and third line.
When presenting such a wrong encoded header to MUAs like mutt or Gnus
they show question marks instead of the real characters at the position
of the wrong line break.

Test environment: Perl 5.8.3 on Debian unstable.
# $Id: Encode.pm,v 1.99 2003/12/29 02:47:16 dankogai Exp dankogai $

Regards
Marc Langer

<Prev in Thread] Current Thread [Next in Thread>