Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: MIME::Parser::Filer and filenames in Simplified Chinese

by zwon (Monsignor)
on Nov 17, 2011 at 15:57 UTC ( #938640=note: print w/ replies, xml ) Need Help??


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

Can't help with MIME::Parser, but you can decode name yourself:

use 5.010; use strict; use warnings; use open qw(:utf8 :std); use Encode::MIME::EncWords; use Encode qw/encode decode/; my $fname = '=?gb2312?B?MzYw0MLOxbzgsuItMTItMDEtQ2hpIFNpbXAudHh0?='; say decode('MIME-EncWords', $fname);


Comment on Re: MIME::Parser::Filer and filenames in Simplified Chinese
Download Code
Re^2: MIME::Parser::Filer and filenames in Simplified Chinese
by uxbod (Initiate) on Nov 21, 2011 at 16:21 UTC

    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 ?

      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"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://938640]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (16)
As of 2014-07-23 17:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (147 votes), past polls