Forum Webscript.Ru
Программирование => Perl => Тема начата: Troum от 03 Марта 2003, 15:48:10
-
Недавно начал разбираться с XML и споткнулся вот на какой проблеме :
при проверке корректности XML-файла с помощью XML::Parser появляется ошибка при попытке использовать кириллицу в файле, при включении кодировки в объявление файла
перл выдает ощибку:
Couldn\'t open encmap windows-1251.enc:
No such file or directory
at C:/Perl/site/lib/XML/Parser.pm line 168
Что бы это значило и как победить?
Использую Perl 5.6 под win
-
Прочти доку к модулю. Там в самом конце все написано.
-
Перерыл все доки - ничего не нашел
Может, подскажешь, где смотреть?
-
Все, решил проблему
Не хватало файла кодировки
Нашел, поставил и все ОК :)
-
Из доки к XML::Parser:
ENCODINGS
XML documents may be encoded in character sets other than Unicode as long as they may be mapped into the Unicode character set. Expat has further restrictions on encodings. Read the xmlparse.h header file in the expat distribution to see details on these restrictions.
Expat has built-in encodings for: UTF-8, ISO-8859-1, UTF-16, and US-ASCII. Encodings are set either through the XML declaration encoding attribute or through the ProtocolEncoding option to XML::Parser or XML::Parser::Expat.
For encodings other than the built-ins, expat calls the function load_encoding in the Expat package with the encoding name. This function looks for a file in the path list @XML::Parser::Expat::Encoding_Path, that matches the lower-cased name with a \'.enc\' extension. The first one it finds, it loads.
If you wish to build your own encoding maps, check out the XML::Encoding module from CPAN.