开发者

SimpleXML Cyrillic Encoding

开发者 https://www.devze.com 2023-03-01 21:06 出处:网络
This is the type of XML file, which I am using: <?xml version=\"1.0\" encoding=\"UTF-8\"?> <ProductCatalog>

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消