如何将IE中的Unicode字符存储到xml中

时间:2012-02-01 09:59:36

标签: php internet-explorer unicode

当我从IE中将中文(这%s资料)字母保存到xml时,我得到了???????在XML文件中。但它适用于Firefox和Chrome。我也在XML和元标记中指定了UTF-8:<?xml version="1.0" encoding="UTF-8"?><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

xml = new DOMDocument('1.0', 'utf-8'); $xml->formatOutput = true; 
$xml->preserveWhiteSpace = false; $xml->load('test.xml'); 
$elements = $xml->getElementsByTagName('key'); 
foreach($elements as $node){ 
    foreach($node->childNodes as $child) { 
        $element = $xml->getElementsByTagName('key')->item($id);  
        $temp = $element->getElementsByTagName($child->nodeName)->item(0); 
        $temp->nodeValue = $_GET[$child->nodeName . '_' . ($id+1) ] ; 
    } 
    break; 
} 
$xml->save("test.xml"); $xml->saveXML(); 

0 个答案:

没有答案