I have some unicode codepoints (\u5315\u4e03\u58ec\u4e8c\u4e0a\u53b6\u4e4b), which I have to convert into actual characters they represent.
What's the simplest way to do so?
Sometimes I'd just use pack:
binmode STDOUT, ':utf8';
my $string = '\\u5315\\u4e03\\u58ec\\u4e8c\\u4e0a\\u53b6\\u4e4b';
$string =~ s/\\u(....)/ pack 'U*', hex($1) /eg;
print $string;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With