[Perl Other] 奇怪的Yaml模块升级(utf8 does not map to Unicode)

Feb 26th, 2010

转载本站文章请注明,转载自:扶凯[http://www.php-oa.com]

本文链接: http://www.php-oa.com/2010/02/26/perl-yaml-utf8-does-not-map-to-unicode.html

太多地方用到YAML的格式了,perl中有很好的解析模块YAML.昨天给他更新了一下.提示出现

[root@localhost etc]# perl -MYAML=’LoadFile’ -e ‘LoadFile("config.yaml.default")’
utf8 "\xC7" does not map to Unicode at /usr/lib/perl5/site_perl/5.8.8/YAML.pm line 77, <$IN> chunk 1.
Malformed UTF-8 character (fatal) at /usr/lib/perl5/site_perl/5.8.8/YAML/Loader.pm line 38, <$IN> line 1.

很奇怪,原来都不用utf8,现在强行utf8了.然后到cpan中看查询记录

---
version: 0.71
date:    Sun Jan 3 12:25:00 AEST 2010
changes:
- Set file encoding to UTF-8 in LoadFile/DumpFile (RT#25434) by Olivier Mengué
- We shouldn't have to care about 5.8.0. Since it's causing CPAN Testers
  failures, bump the minimum Perl to 5.8.1

原因就是这样,搞到我现在所有的软件都需要注意,如果各位有使用gb2312做YAML配置的话,记的这个地方要小心.因为从0.71起就不在支持gb2312的YAML了,

有个备选的方案,使用唐凤写的YAML::Syck会有更加好的性能,对GB2312也是支持的.

 

Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪 ViVi 365Key 网摘 天极网摘 和讯网摘 博拉网 POCO 网摘 饭否 QQ 书签 Digbuzz 我挖网 Mister Wong
Tags: ,
  1. 小黑
    Aug 31st, 2010 at 09:05
    Reply | Quote | #1

    习惯YAML::Tiny 唐凤的版本需要C库支持 不懂C 想调整点什么都不行 -_-!