I have created a test xml whose content is in gujrati using php
我已经使用php创建了一个测试xml,其内容在gujrati中
$doc = new DomDocument('1.0','UTF-8');
$fieldvalue = mb_convert_encoding($question['questiontext'],'ISO-8859-1','UTF-8');
$value2 = $doc->createTextNode($fieldvalue);
XML file is created successfully but when i try to use simplexml_load_file function to render the XML content i get the following errors:
XML文件已成功创建,但是当我尝试使用simplexml_load_file函数呈现XML内容时,我收到以下错误:
Warning:
simplexml_load_file()
[function.simplexml-load-file]: testsxml/test27_4.xml:2: parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0xC9 0xD6 0xF7 0x20警告:simplexml_load_file()[function.simplexml-load-file]:testsxml / test27_4.xml:2:解析器错误:输入不正确UTF-8,表示编码!字节:0xC9 0xD6 0xF7 0x20
1 个解决方案
#1
I have experienced the same problem, and it was solved by using utf8encode. I see you have use the multi byte version, but trying this might be worth a shot. Also make sure you are not encoding things twice.
我遇到了同样的问题,使用utf8encode解决了这个问题。我看到你使用了多字节版本,但尝试这个可能值得一试。还要确保您没有对事物进行两次编码。
One more thing. I suppose DomDocument does it for you, but check that & is & and so on.
还有一件事。我想DomDocument是为你做的,但检查一下&是&等等。
#1
I have experienced the same problem, and it was solved by using utf8encode. I see you have use the multi byte version, but trying this might be worth a shot. Also make sure you are not encoding things twice.
我遇到了同样的问题,使用utf8encode解决了这个问题。我看到你使用了多字节版本,但尝试这个可能值得一试。还要确保您没有对事物进行两次编码。
One more thing. I suppose DomDocument does it for you, but check that & is & and so on.
还有一件事。我想DomDocument是为你做的,但检查一下&是&等等。