September 24, 2005
このあいだ紹介した、Unicode::RecursiveDowngrade ですが、弾さんが、
404 Blog Not Found:UTF-8 Flagを落とそうとして思わぬBugを見つけた話
確かに、Storable の perldoc を読むと
いやぁ、これは全然知らんかったですねぇ…。
が、しかし、弾さんが
で、今日ナニゲに CPAN を散策していたら、Unicode::RecursiveDowngrade が 0.02 にバージョンアップしていますねぇ。
見る限り、弾さんが指摘していた二点も解消されているっぽいです。
ということで、その二点が気になる方は、いつ訪れるかわからない Storable の bugfix を待つよりは、Unicode::RecursiveDowngrade の 0.02 以降を使ったら良さそうです。
ちとモジュール名が長すぎてタイプ量が多いのがアレですが。。。
404 Blog Not Found:UTF-8 Flagを落とそうとして思わぬBugを見つけた話
これじゃ、駄目。と一言で、一刀両断されてますた。
以下ダメな点を。と駄目な点を挙げつつ、Storable モジュールの
- Hash Keyに未対応
- Blessed Referenceに未対応
$Storable::drop_utf8というのを使ったソリューションを公開されてました。確かに、Storable の perldoc を読むと
Perl 5.6 added support for Unicode characters with code points > 255, and Perl 5.8 has full support for Unicode characters in hash keys. Perl internally encodes strings with these characters using utf8, and Storable serializes them as utf8. By default, if an older version of Perl encounters a utf8 value it cannot represent, it willとちゃんと明記されています。croak(). To change this behaviour so that Storable deserializes utf8 encoded values as the string of bytes (effectively dropping the is_utf8 flag) set$Storable::drop_utf8to someTRUEvalue. This is a form of data loss, because with$drop_utf8true, it becomes impossible to tell whether the original data was the Unicode string, or a series of bytes that happen to be valid utf8.
いやぁ、これは全然知らんかったですねぇ…。
が、しかし、弾さんが
ダメダメいうだけではダメなので、以下、代案....を出そうとしたら、StorableのBugを見つけてしまったかも。なんやら、Storable のこのあたりがバグってらっしゃる模様。
で、今日ナニゲに CPAN を散策していたら、Unicode::RecursiveDowngrade が 0.02 にバージョンアップしていますねぇ。
見る限り、弾さんが指摘していた二点も解消されているっぽいです。
ということで、その二点が気になる方は、いつ訪れるかわからない Storable の bugfix を待つよりは、Unicode::RecursiveDowngrade の 0.02 以降を使ったら良さそうです。
ちとモジュール名が長すぎてタイプ量が多いのがアレですが。。。