use strict; use warnings; use utf8 ; use Encode; use Data::Dump qw/dd pp/; use Devel::Peek; use MIME::Base64 ; my $str ='Ä'; warn "\n*** orig str='$str'"; Dump $str; our $encoded = MIME::Base64::encode_base64($str); warn "\n*** encode_b64 encoded='$encoded'"; Dump $encoded; warn "\n*** decode_b64"; our $decoded = MIME::Base64::decode_base64($encoded); Dump $decoded; warn "\n*** encode_utf8"; $decoded = Encode::encode_utf8($decoded); Dump $decoded; warn "\n*** _utf8_on"; Encode::_utf8_on($decoded); Dump $decoded; #### *** orig str='Ä' at c:/tmp/b64_utf8.pl line 12. SV = PV(0x54c9d8) at 0x5a8b00 REFCNT = 1 FLAGS = (PADMY,POK,pPOK,UTF8) PV = 0x5471d8 "\303\204"\0 [UTF8 "\x{c4}"] CUR = 2 LEN = 16 *** encode_b64 encoded='xA== ' at c:/tmp/b64_utf8.pl line 17. SV = PV(0x54caa8) at 0x26dbcb8 REFCNT = 1 FLAGS = (POK,pPOK) PV = 0x547478 "xA==\n"\0 CUR = 5 LEN = 16 *** decode_b64 at c:/tmp/b64_utf8.pl line 21. SV = PV(0x54cb08) at 0x26da130 REFCNT = 1 FLAGS = (POK,pPOK) PV = 0x28d2b98 "\304"\0 CUR = 1 LEN = 16 *** encode_utf8 at c:/tmp/b64_utf8.pl line 25. SV = PV(0x54cb08) at 0x26da130 REFCNT = 1 FLAGS = (POK,pPOK) PV = 0x28d2c28 "\303\204"\0 CUR = 2 LEN = 16 *** _utf8_on at c:/tmp/b64_utf8.pl line 29. SV = PV(0x54cb08) at 0x26da130 REFCNT = 1 FLAGS = (POK,pPOK,UTF8) PV = 0x28d2c28 "\303\204"\0 [UTF8 "\x{c4}"] CUR = 2 LEN = 16