Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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

by zwon (Abbot)
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);

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2018-02-23 19:13 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (309 votes). Check out past polls.