Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的后端服务器(Java)有以下响应:
\x{57fc}\x{7389}\x{770c}
当我尝试在 Perl 中编码时,我得到了这个:
JSON::XS->new->utf8->encode($text); output: å¼çç
它应该是:
埼玉県
我可以在 Perl 中使用什么方法来正确显示这个日文文本?页面编码是正确的,因为其他日文文本正确显示,只是 Java 返回的这段代码很奇怪。
看起来解决方案非常简单。当它看起来像这样时,文本已经是 utf8 了。因此,只需删除 utf8 选项即可解决问题。
JSON::XS->new->encode($text);