Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

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
Replies are listed 'Best First'.
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


    should decode to:


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


    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?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2015-10-10 05:32 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (254 votes), past polls