xachen has asked for the wisdom of the Perl Monks concerning the following question:
However if I print $_ it outputs as:$_ = "\\x{6b63}";
I'm not trying to output the "literal string" but the chinese character which is 正. Any pointers? The following code executes:\x{6b63}
Thanks, Justinuse Encode; $_ = "\u6b63"; $_ =~ s/\\u(.{4})/chr($1)/eg; $char = "\\x{$_}"; print "raw is $char \n"; print "decode is " . Encode::decode("unicode", $char). "\n"; __UNDESIRED OUTPUT__ raw is \x{6b63} decode is \x{6b63}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: unicode/utf string to actual character
by moritz (Cardinal) on Sep 22, 2009 at 19:14 UTC | |
|
Re: unicode/utf string to actual character
by zwon (Abbot) on Sep 22, 2009 at 19:10 UTC | |
by xachen (Novice) on Sep 22, 2009 at 19:14 UTC | |
by ikegami (Patriarch) on Sep 22, 2009 at 19:32 UTC | |
|
Re: unicode/utf string to actual character
by ikegami (Patriarch) on Sep 22, 2009 at 19:56 UTC | |
|
Re: unicode/utf string to actual character
by graff (Chancellor) on Sep 23, 2009 at 00:36 UTC |