in reply to XML::Parser Shift_JIS encoding

Looking at a few different versions of 5.8 (5.8.1 on macosx, 5.8.5 on freebsd), I see a "shiftjis" encoding, which ought to work.

Even if XML::Parser doesn't think it exists, you could at least use Encode::decode the convert the source data into utf8 before getting XML::Parser involved in the process (assuming that this module is okay for handling utf8 data).

Replies are listed 'Best First'.
Re^2: XML::Parser Shift_JIS encoding
by zeimusu (Sexton) on Sep 16, 2004 at 03:46 UTC

    Ok I got this figued out.

    The encoding files identify themselves in their header, and the name of the encoding in the header had better match the file name.

    So, with a binary editor I edited the encoding name in the file from x-sjis-cp932 to shift_jis (you have to be careful not to change the file length, so you have to pad the encoding name with NUL characters, in vim that NUL can be entered with Ctrl-K N U.

    That file is saved as shift_jis.enc, then my sample script runs fine. It wasn't anything to do with cygwin, hearty apologies for bad mouthing their fine dll.

    A safer way to do this would be to remake the encoding files with the XML::Encoding package, but this works as a quick fix.

    James