Click to See Complete Forum and Search --> : Parse XML Error


bendurber
06-12-2008, 11:38 AM
Hi,

I am trying to send data that a user enters into the system via XML. The problem is that some special characters are causing an error, in particular the '–' character which is different to the normal minus sign (the only way I know how to get it is using outlook, entering a minus sign then return and it makes the sign larger).

How can I detect these either on entry or when returning from the database?

In Firefox it displays � which I don't mind but Internet Explorer returns an error so the page doesn't load.

Any help would be much appreciated.

Thanks

Ben

sridhar_423
06-12-2008, 12:09 PM
try setting the content-type header of the XML as UTF-8

bendurber
06-12-2008, 12:12 PM
My header is:
<?xml version="1.0" encoding="UTF-8"?>

Is that correct?

bendurber
06-12-2008, 12:15 PM
I changed the encoding to iso-8859-1 and it works, what does this mean, compared to UTF-8?

sridhar_423
06-12-2008, 12:24 PM
as far as I understand, that header(XML declaration part) doesn't matter. Only the encoding which you use while the saving the file matters.
e.g. when u save an XML file to your disk, you need to choose the encoding type (which I see as an equivalent to setting a HTTP header when the XML is returned from a server to client)
I'm not sure how to set the encoding header in a php script while sending out the XML.. I'll post here if I find any useful information for setting the encoding header.

sridhar_423
06-12-2008, 12:28 PM
really.. thts gr8.. my understanding might be wrong in that case
Are you able to see the symbol properly?

bendurber
06-12-2008, 12:33 PM
In Firefox I can see the character and in IE it doesn't return any error but the character is replaced by a square box.

It suits my needs for now.

Thanks

Ben

sridhar_423
06-12-2008, 12:46 PM
This thread not only resolved your issue(atleast as of now), but also unturned some of my wrong concepts..on which I need to do some reading
thanks to your question :)