merlinX has asked for the wisdom of the Perl Monks concerning the following question:
I want to convert <U+xxxx> literals into wide hexadecimal values, how do I do that? Probably trivial, but I don't see it now...
use Encode; use encoding 'utf8'; my $test = "<U+010C>"; $test=~s/\<U\+(.*)\>/\\x\{$1\}/g; print "$test\n"; # prints \x{010C} my $probe1=encode("utf8","\x{010C}"); # works my $probe2=encode("utf8","$test"); # does not work?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: convert scalar to wide hexadecimal value? how?
by JavaFan (Canon) on Jan 14, 2009 at 11:16 UTC | |
by merlinX (Novice) on Jan 14, 2009 at 12:11 UTC | |
by merlinX (Novice) on Jan 14, 2009 at 12:43 UTC | |
by JavaFan (Canon) on Jan 14, 2009 at 12:57 UTC | |
|
Re: convert scalar to wide hexadecimal value? how?
by moritz (Cardinal) on Jan 14, 2009 at 12:07 UTC | |
by JavaFan (Canon) on Jan 14, 2009 at 13:07 UTC |