in reply to How to transform a string containing unicode into utf8?

Use a regular expression to grab \u followed by four hex digits, then use hex and chr to convert that to a character.

use utf8::all; my $str = <<'EOF'; global.lifeTime=\u00C9lettartam global.lifeTime_from=\u00C9lettartam \u00F3ta global.lifeTime_to=\u00C9lettartam eddig fastExport.tooltip=Javaslat a lapoz\u00E1sra\: kattintson a grafik\u00 +E1ra <br /> Tartsa lenyomva a bal eg\u00E9rgombot, mik\u00F6zben az e +geret mozgatja. EOF $str =~ s{ \\u([0-9A-F]{4}) }{ chr hex $1 }egix; print $str;
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Replies are listed 'Best First'.
Re^2: How to transform a string containing unicode into utf8?
by Anonymous Monk on Oct 24, 2012 at 09:54 UTC
    Great! That works. Thanks a lot!