SimpleXML Cyrillic Encoding
This is the type of XML file, which I am using:
<?xml version="1.0" encoding="UTF-8"?>
<ProductCatalog>
<Prod开发者_运维问答uctType>Дънни платки</ProductType>
<ProductType>Дънни платки 2</ProductType>
</ProductCatalog>
And when I run the PHP file with the following code:
$pFile = new SimpleXMLElement('test.xml', null, true);
foreach ($pFile->ProductType as $pChild)
{
var_dump($pChild);
}
I get the following results:
object(SimpleXMLElement)#5 (1) { [0]=> string(40) "Дънна платка наÑтолна"
I have tried different encodings in the XML file but it's not working well with Cyrillic symbols.
What happens if you switch Character encoding (to utf-8) in browser? I mean, looks like output issue.
精彩评论