与此问题和此答案(另一个问题)相关,我仍然无法使用JSON处理UTF-8.
我已经尝试确保根据最好的专家的建议调用所有必需的巫术,并且据我所知,该字符串尽可能有效,标记并标记为UTF-8.但仍然perl死于其中任何一个
Uncaught exception: malformed UTF-8 character in JSON string
Run Code Online (Sandbox Code Playgroud)
要么
Uncaught exception: Wide character in subroutine entry
Run Code Online (Sandbox Code Playgroud)
我在这做错了什么?
(hlovdal) localhost:/work/2011/perl_unicode>cat json_malformed_utf8.pl
#!/usr/bin/perl -w -CSAD
### BEGIN ###
# Apparently the very best perl unicode boiler template code that exist,
# https://stackoverflow.com/questions/6162484/why-does-modern-perl-avoid-utf-8-by-default/6163129#6163129
# Slightly modified.
use v5.12; # minimal for unicode string feature
#use v5.14; # optimal for unicode string feature
use utf8; # Declare that this source unit is encoded as UTF?8. Although
# once …Run Code Online (Sandbox Code Playgroud)