CC: | 10130344 [...] ticket.noris.net |
Subject: | utf8::downgrade() for strings given to MIME::Base64::encode() |
When an internally utf8 encoded string is given to
MIME::Base64::encode(), the string gets utf8::downgrade():
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$ cat ./mime-base64
#!/usr/local/bin/perl -w
use strict;
use utf8;
use Devel::Peek;
use MIME::Base64;
my $s = 'Täst';
utf8::upgrade($s);
print STDERR '$s before: '; Dump($s);
print STDERR "\nbase64: " . MIME::Base64::encode($s) . "\n";
print STDERR '$s after: '; Dump($s);
$ ./mime-base64
$s before: SV = PV(0x8163040) at 0x8178c28
REFCNT = 1
FLAGS = (PADMY,POK,pPOK,UTF8)
PV = 0x817e890 "T\303\244st"\0 [UTF8 "T\x{e4}st"]
CUR = 5
LEN = 8
base64: VORzdA==
$s after: SV = PV(0x8163040) at 0x8178c28
REFCNT = 1
FLAGS = (PADMY,POK,pPOK)
PV = 0x817e890 "T\344st"\0
CUR = 4
LEN = 8
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Disclaimer: I'm not sure if this is to be considered a bug in
_this_ module, since you normally would not want to pass text
strings to MIME::Base64::encode(), anyway. However, at least
Data::Dump::pp() does that under certain circumstances.
(Cmp. bug 60103.)
Regards,
fany