DomDocument编码 [英] DomDocument encoding

查看:86
本文介绍了DomDocument编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有小问题。我正在尝试处理XML文件,但是UTF-8字符编码不起作用。

I have small problem. I'm trying to work on an XML file, but the UTF-8 character encoding not working.

示例:

$dom = new DomDocument('1.0', 'UTF-8');     
if(!$dom->load($url))
    die('There is a problem to getting the source file!');

输出:

Array(
    [league] => Regionalliga Süd
    [team1] => WORMATIA WORMS
    [team2] => 1. FC NÃœRNBERG II
)

关于此问题的任何建议吗?

Any suggestion regarding this problem?

推荐答案

这不是XML文档编码的问题,而是正在运行的PHP脚本编码的问题。确保php脚本也以UTF-8编码,并且正确的charset-header发送到浏览器。

It's not a problem of the encoding of the XML-document, it's a problem of the encoding of the running PHP-script. Be sure that the php-script is also encoded in UTF-8 and the correct charset-header is sent to the browser.

这篇关于DomDocument编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆