You are here:  » Odd Parser result


Odd Parser result

Submitted by baggagepin on Mon, 2010-05-17 12:31 in

Hi all,

I am trying to process an XML file which is in the following format:

<currencies><rate swift="AED" buy="6.2140" sell="5.0265"/><rate swift="AUD" buy="1.8637" sell="1.5387"/><rate swift="BBD" buy="3.3305" sell="2.6765"/></currencies>

If I use the DEMO page on the MagicParser site I get an odd result. The field name results is "ÿþ". Does anuone know where the "ÿþ" is coming from.

Best regards,

Dereck

Submitted by support on Mon, 2010-05-17 12:39

Hi Dereck,

The demo page generates output in utf-8, so the strange characters would indicate that your feed is encoded in ISO-8859-1. You can make sure that your script generates the correct output by adding the following code on the first line:

  header("Content-Type: text/html; charset=iso-8859-1");

However, as you mention that is's a field name that contains the strange characters, then it would indicate that feed format auto-detection has not actually worked, which would point towards the character set encoding pre-amble in the file being invalid.

What I would suggest is making sure that you're using the correct Format String, which in which in this case, if <currencies> is the top level element, would be:

xml|CURRENCIES/RATE/

You can set this as the Format String in the last form on the demo page after you submit / upload your data; or in your script as the optional 3rd parameter to MagicParser_parse()...

Hope this helps!
Cheers,
David.

Submitted by baggagepin on Mon, 2010-05-17 13:06

Hi David,

In all my 34 years in IT, yes well before the PC came, I have never had such fast responses to technical issues along with accurate solutions.

Your product and site are with out doubt, second to none.

Well done.

ISSUE RESOLVED.

Best regards,

Dereck