Why does XML display error on certain special characters and some are ok?
For instance, below will create error,
<?xml version="1.0" standalone="yes"?>
<Customers>
<Customer>
<Name>Löic</Name>
</Customer>
</Customers>
but this is ok,
<?xml version="1.0" standalone="yes"?>
<Customers>
<Customer>
<Name>&</Name>
</Customer>
</Customers>
I convert the special character through php - htmlentities('Löic',ENT_QUOTES)
by the way.
How can I get around this?
Thanks.
EDIT:
I found that it works fine if I use numeric character such as Lóic
now I have to find how to use php to convert special characters into numeric characters!
This can be caused by a failed Firefox update that left you with a mixture of old and updated files in the Firefox program folder. This can happen in case security software was keeping a handle of some of the files in the Firefox program folder preventing Firefox from replacing all the files.
The most common cause is encoding errors. There are several basic approaches to solving this: escaping problematic characters ( < becomes < , & becomes & , etc.), escaping entire blocks of text with CDATA sections, or putting an encoding declaration at the start of the feed.
You can do a clean reinstall and remove the Firefox program folder to ensure that all files are replaced. You may have to disable security software temporarily in case the problem persists. You can create a new profile as a quick test to see if your current profile is causing the problem.
There are five entities defined in the XML specification — &
, <
, >
, '
and "
There are lots of entities defined in the HTML DTD.
You can't use the ones from HTML in generic XML.
You could use numeric references, but you would probably be better off just getting your character encodings straight (which basically boils down to:
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With