我想从2个HEX对生成一个UTF-8字符。 HEX对来自字符串。从两个HEX对生成一个UTF-8字符
此代码:
use Encode;
my $bytes = "\xC3\xA9";
print decode_utf8($bytes);
# Prints: é and is correct
此代码不起作用:
use Encode;
my $byte1 = "C3";
my $byte2 = "A9";
my $bytes = "\x$byte1\x$byte2";
print decode_utf8($bytes);
这里是我想生成的字符:http://www.fileformat.info/info/unicode/char/00e9/index.htm
感谢您的任何提示!
此答案完美工作!我很感谢帮助。 ikegami的答案帮助我了解了十六进制值发生了什么。 – iohans 2013-03-06 10:09:17