£为什么? XML ISO编码问题? [英] £ becomes £ Why? XML ISO encoding issue?

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

问题描述

通过PHP和SimpleDOM.php

Been happily saving things to my XML files via a web form that is pared by PHP and the SimpleDOM.php

通过Web表单快乐地将东西保存到我的XML文件中我需要保存具有英文定价的项目他们所以我需要英镑的标志。但是当我这样做时,会发生两件事情:

I need to save items that have English pricing in them so I need the English pound sign. However when I do this 2 things happen:


  1. 它返回保存的价格为£

  1. it returns the saved price as £

如果我再次保存它,而没有任何其他更改,SimpleDom解析器然后barfs,它删除超出英镑的XML文件中的任何其他内容。

if I then save it again without any other changes the SimpleDom parser then barfs and it removes any other content inthe XML file beyond the english pound sign.

我的XML文件中的顶行看起来像

The top line in my XML file looks like

<?xml version="1.0" encoding="ISO-8859-1"?>

在XML文件里面,£被保存为

Inside the XML file the £ is being saved as

&amp;Acirc;&amp;pound;

据我所知,iso-8859-1应该有£标志,所以非常困惑为什么这个Acirc进来了....

As far as I can tell iso-8859-1 should have the £ sign in it, so very confused why this Acirc is coming into it....

我看到另一个线程有人说尝试使用8859-15,但没有任何区别。

I saw on another thread someone said try using 8859-15 but that didnt make any difference.

任何想法的人?

Cheers
Jas
(完整的nube到所有这些编码的东西) / p>

Cheers Jas (complete nube to all this encoding stuff)

推荐答案

$ 的unicode代码点是U + 00A3。在UTF-8编码中,它是 0xC2 0xA3 。现在,在ISO-8859-1中,0xC2是Å,0xA3是£。所以,在流程的某个地方,你输入的是UTF-8,它被解释为ISO-8859-1。您是否在达到PHP代码之前查看了表单如何对数据进行编码。

The unicode code point for £ is U+00A3. In the UTF-8 encoding it is 0xC2 0xA3. Now, in ISO-8859-1 0xC2 is Å, and 0xA3 is £. So, somewhere in the flow, what you enter becomes UTF-8 which is interpreted as ISO-8859-1. Have you looked at how the "form" encodes the data before reaching your PHP code.

此外,这个SimpleDOM在做什么是w.r.t.实体? &安培; ACIRC;和&不具有声明的XML实体无效。 SimpleDOM是否添加声明?

And, besides, what is this SimpleDOM doing w.r.t. entities? &Acirc; and &pound; are not valid XML entities without a declaration. Does SimpleDOM add the declarations?

这篇关于£为什么? XML ISO编码问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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