Hello,
I have a Unicode string that I would like to convert into quoted-
printable encoding, but if I do:
#!/usr/bin/perl
use utf8;
use MIME::QuotedPrint;
my $unicode_string = "xxx" # where I have real Unicode string, for
example Japanese characters...
$encoded = encode_qp($unicode_string);
print "qp: $encoded\n";
I get the error message:
"Wide character in subroutine entry"
If I comment out the "use utf8", I get the right result, but I need
it for my script.
I tried also to convert the Unicode string to data using the code
$native_string = pack("C*", unpack("U*", $Unicode_string));
that I found in perluniintro, but I get the error message:
"Character in 'C' format wrapped in pack"
What am I doing wrong?
Thank you very much in advance for any help.
Best regards,
Nobumi Iyanaga
Tokyo,
Japan
Gisle Aas - 07 Oct 2006 15:04 GMT
> What am I doing wrong?
You did not read 'perldoc MIME::QuotedPrint' to the end :)
| Perl v5.8 and better allow extended Unicode characters in strings. Such strings
| cannot be encoded directly, as the quoted-printable encoding is only defined for
[quoted text clipped - 6 lines]
| $encoded = encode_qp(encode("UTF-8", "\x{FFFF}\n"));
| print $encoded;
Regards,
Gisle
Nobumi Iyanaga - 07 Oct 2006 15:17 GMT
Hello Gisle,
>> What am I doing wrong?
>
[quoted text clipped - 13 lines]
> | $encoded = encode_qp(encode("UTF-8", "\x{FFFF}\n"));
> | print $encoded;
Ah, thank you very much indeed!
Best regards,
Nobumi Iyanaga
Tokyo,
Japan