XML_Parser bug
| From: | Denis Gerasimov | Date: | Fri, 27 Aug 2004 12:10:52 +0000 |
| Subject: | XML_Parser bug | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-14323@lists.php.net to get a copy of this message | ||
Hello All,
I use XML_Parser 1.2.0 (latest version).
The bug is that it doesn't work properly with Russian text (I think there
may be also problems with other languages different to English).
Server configuration:
OS: Windows 2000 Professional SP4
Web server: Apache 2.0.50
PHP: PHP 5.0.1
I run the following piece of code:
class Handler
{
function startHandler($objParser, $strName, $arrAttrs)
{
printf('handle start tag: %s<br />', $strName);
print '<br>Attbibs: ';
print_r($arrAttrs);
}
function endHandler($objParser, $strName)
{
printf('handle end tag: %s<br />', $strName);
}
}
$objParser = new XML_Parser();
$objHandler = new Handler();
$objParser->setInputFile('Sample.xml');
$objParser->setHandlerObj($objHandler);
$objParser->parse();
The result is:
handle start tag: ADMININTERFACE
Attbibs: Array ( ) handle start tag: TITLE
........
Attbibs: Array ( [CLASSNAME] => table ) handle start tag: DATACOLUMN
Attbibs: Array ( [CAPTION] => ????????????? ) handle end tag: DATACOLUMN
handle start tag: DATACOLUMN
Attbibs: Array ( [CAPTION] => ??? ) handle end tag: DATACOLUMN
handle start tag: DATACOLUMN
Attbibs: Array ( [CAPTION] => ????????? ) handle end tag: DATACOLUMN
handle start tag: DATACOLUMN
Attbibs: Array ( [CAPTION] => ????? ) handle end tag: DATACOLUMN
handle end tag: DATAGRID
handle start tag: DATAFORM
........
handle end tag: DATAFORM
handle end tag: ADMININTERFACE
As you can see all non-ASCII characters were replaced with '?'.
I tried to parse XML documents in both windows-1251 and UTF-8 encoding (with
correct "encoding" attribute) but got absolutely same result.
Does anybody know why this happened?
Any help or hints will be greatly appreciated.
Best regards, Denis Gerasimov
Outsourcing Services Manager,
VEKOS, Ltd.
www.vekos.ru