I had a bug report on the MIME::Base64 module because it kind of depends on the strings passed to its encode() to be NUL-terminated. This is not always the case for the strings produced by the Encode module. This program demonstrates: #!perl -w use Encode qw(encode find_encoding); use Devel::Peek qw(Dump); Dump(encode("UTF-16BE", "abc")); Dump(find_encoding("UTF-16BE")->encode("abc")); With perl-5.8.1 this prints: SV = PV(0x819f878) at 0x811f434 REFCNT = 1 FLAGS = (TEMP,POK,pPOK) PV = 0x8189060 "\0a\0b\0c"\0 CUR = 6 LEN = 7 SV = PV(0x819f878) at 0x811f458 REFCNT = 1 FLAGS = (TEMP,POK,pPOK) PV = 0x8194fb0 "\0a\0b\0c" CUR = 6 LEN = 6 Note that the first form does the right thing while the second does not. Regards, GisleThread Previous | Thread Next