« 5月31日の行動 | メイン | 本日の体操 »
2005年05月31日
[技術] XML::Parser
【技術メモ】
XML::Parserで、日本語がUTF-8でなくて、euc-jpを扱えるようにするには以下のようにXML::ParserのEncoding用のファイルを変更する必要があるみたい。
http://homepage3.nifty.com/hippo2000/perltips/xml/xmlenc.htm
とりあえず、上記サイトより、Encoding.tar.gzを取得して、下記のように解凍して、eucとsjisのマッピングファイルをコピーした。日本語がEUCのXMLファイルのパースがちゃんとできた。
[y-ishiha@tama y-ishiha]$ tar xvfz Encoding.tar.gz
Encoding/
Encoding/Japanese_Encodings.msg
Encoding/Japanese_Encodings_J.msg
Encoding/mkenc/
Encoding/mkenc/example/
Encoding/mkenc/example/euc-jp.enc
Encoding/mkenc/example/shift_jis.enc
Encoding/mkenc/example/x-euc-jp-unicode.enc
Encoding/mkenc/example/x-sjis-cp932.enc
Encoding/mkenc/mkenc.pl
Encoding/mkenc/readme.txt
Encoding/mkenc/readme_e.txt
Encoding/test/
Encoding/test/result
Encoding/test/tenc.pl
Encoding/test/teste.xml
Encoding/test/testsj.xml
Encoding/MANIFEST
Encoding/MANIFEST_J
[y-ishiha@tama y-ishiha]$ su
Password:
[root@tama y-ishiha]# cd Encoding/mkenc/example/
[root@tama example]# cp euc-jp.enc /usr/local/lib/perl5/site_perl/5.8.6/i686-li
nux/XML/Parser/Encodings/
[root@tama example]# cp shift_jis.enc /usr/local/lib/perl5/site_perl/5.8.6/i686-linux/XML/Parser/Encodings/
[root@tama example]#
投稿者 nekobara : 2005年05月31日 22:31
トラックバック
このエントリーのトラックバックURL:
http://www.ishihara.ne.jp/mt/mt-tb.cgi/287