使用 bash:
$ echo '\u043f\u0441\u0438\u0445\u043e\u0442\u0435\u0440\u0430\u043f\u0438\u044f.net' | ascii2uni -a U -q
психотерапия.net
如何用 perl 做到这一点?
use utf8;
use URI::_punycode (decode_punycode,encode_punycode);
$fqdn = "\u043f\u0441\u0438\u0445\u043e\u0442\u0435\u0440\u0430\u043f\u0438\u044f.net";
$fqdn = `echo $fqdn | ascii2uni -a U -q`;
$unicode = encode_punycode($fqdn);
print "$unicode\n";
返回:
$ perl test.pl
043f044104380445043e0442043504400430043f0438044f.net