Been happily saving things to my XML files via a web form that is pared by PHP and the SimpleDOM.php
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:
-
it returns the saved price as £
-
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.
The top line in my XML file looks like
<?xml version="1.0" encoding="ISO-8859-1"?>
Inside the XML file the £ is being saved as
&Acirc;&pound;
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….
I saw on another thread someone said try using 8859-15 but that didnt make any difference.
Any ideas folks?
Cheers
Jas
(complete nube to all this encoding stuff)
The unicode code point for
£is U+00A3. In the UTF-8 encoding it is0xC2 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.And, besides, what is this SimpleDOM doing w.r.t. entities? Â and £ are not valid XML entities without a declaration. Does SimpleDOM add the declarations?