in reply to Re: MIME::Parser::Filer and filenames in Simplified Chinese
in thread MIME::Parser::Filer and filenames in Simplified Chinese

Thanks Zwon. I have managed to get a little further but now I have an issue between Simplified and Traditional Chinese.

The MIME encoding for the following file name

=?gb2312?B?MzYw0MLOxbzgsuItMTItMDEtQ2hpIFNpbXAudHh0?=

should decode to:

DPM2007exchange電郵與郵箱修復.zip

but when I try and decode that name in Perl it comes out as:

DPM2007exchange���]�c�]箱修��.zip

I have installed the Encode::HanExtra module but even with that it is still not showing correctly. Am I missing some other type of module ?

  • Comment on Re^2: MIME::Parser::Filer and filenames in Simplified Chinese

Replies are listed 'Best First'.
Re^3: MIME::Parser::Filer and filenames in Simplified Chinese
by Anonymous Monk on Nov 21, 2011 at 16:36 UTC

    comes out as where? Showing correctly where?

    Does the program produce the correct bytes?

      Here is some test code I am using to try and resolve the problem
      #!/usr/bin/perl use Encode; use Encode::CN; use Encode::TW; use MIME::EncWords qw ( /decode_mimewords/); binmode STDOUT, ":utf8"; my $text = "=?gb2312?B?RFBNMjAwN2V4Y2hhbmdl64rgXcVj4F3P5NDej80uemlw?=" +; my(@chunks) = decode_mimewords($text); for my $pair (@chunks) { my($data,$encoding) = @$pair; my $filename = Encode::decode($encoding,$data); print $filename . "\n"; }
        Actually I have just modified my test program to use Zwons code and that worked perfectly! Thank you so so much :)

        Spoke to soon :( Even though it is decoded correctly when displayed if you dump the output one sees

        DPM2007exchange電郵與郵箱修復.zip

        $VAR1 = "DPM2007exchange\x{96fb}\x{90f5}\x{8207}\x{90f5}\x{7bb1}\x{4fee}\x{5fa9}.zip";

        This the does not match the physical file that resides on the server. How can one get them to be the same ?