【发布时间】:2011-07-15 07:02:29
【问题描述】:
可能重复:
php: using DomDocument whenever I try to write UTF-8 it writes the hexadecimal notation of it.
这是一段sn-p代码:
echo "<char>".$row{'char'}."</char>";
row{'char'} 正在从数据库中拉回德语字符 ö。在 PHP 中,如何将其转换为正确的编码以便在 XML 中正确使用?
是否有 PHP 函数可以根据需要将所有内容转换为正确的 XML 格式?还是我需要一个字一个字地做,像这样?
echo "<format>".str_replace("&", "&", $row{'format'})."</format>";
感谢您的帮助!
【问题讨论】:
-
XML处理指令是否包含编码,例如
<?xml version="1.0" encoding="UTF-8"?> -
您的数据库中的编码是什么?异8859-1? utf-8?
标签: php xml utf-8 formatting character-encoding