ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-win32-users
perl-win32-users
Re: need help with utf8
by Ing. Branislav Gerzo other posts by this author
May 23 2005 12:57AM messages near this date
view in the new Beta List Site
need help with utf8 | Re: Grep and list notation
assistent@[...].ru [a], on Monday, May 23, 2005 at 05:12 (UT) wrote:

a>  typical filename in mail message looks like
a>  my $name="=?UTF-8?B?0L8xX9C80LXRgdGP0YfQvdCw0Y8ucnRm?=";
a>  i need to convert this to utf8 and then to cp1251
a>  How precisely to do this ?

I think you have to decode this via MIME, and after to cp1251. But
some characters aren't in 1251, so I use something different:

use Unicode::Normalize;
#decode here via MIME to utf-8
$string = acc($utf8);

sub acc {
    (my $str = NFD(decode("utf8", shift))) =~ s/\pM//og;
    return $str;
}

-- 

How do you protect mail on web? I use http://www.2pu.net

[Blue Wave Reader v2.30.  Available in 3 flavors!  Try one!]




_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:

Ing. Branislav Gerzo

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved