PerlPages
aus ThiesenWiki, der freien Wissensdatenbank
XML::Parser::Expat throws "Couldn't open encmap"
Source: http://adrian.heissler.at/perl.shtml (with corrections)
The XML::Parser package comes only with a small collection of compiled encoding maps. You can add further encoding support by using two small tools from the XML::Encoding package. In Debian, apt-get install libxml-encoding-perl and the needed scripts can be found in /usr/share/doc/libxml-encoding-perl/examples. Perform the following steps to compile your own encoding maps (make sure to adjust the encoding name where necessary):
1. Download the preferred encoding map from ftp://ftp.unicode.org/Public/MAPPINGS, i.e.:
# wget ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-15.TXT
2. Run make_encmap from the XML::Encoding package as follows: make_encmap ENCODING ENCODING.TXT > ENCODING.encmap
# ./make_encmap iso-8859-15 8859-15.TXT > iso-8859-15.encmap
3. Add expat='yes' to the first line of the newly created encmap file
<encmap name='iso-8859-15' expat='yes'>
4. Run compile_encoding from the XML::Encoding package as follows: compile_encoding -o ENCODING.enc ENCODING.encmap
./compile_encoding -o iso-8859-15.enc iso-8859-15.encmap
5. Copy the newly created encoding map to your Parser encodings directory.
mv iso-8859-15.enc /usr/lib/perl5/XML/Parser/Encodings/
