0

I have an app that makes a request to an API, and then gets back an XML response which up until this week, I've had no problems parsing. However within the last few days, when I make the request over AT&T's cellular network, random characters are being inserted into the response. I've tested this over T-Mobile and Verizon and haven't had any issues, and WIFI is also returning a clean response. I saw a post about a similar issue with Android, but I don't think it's exactly the same.

Has anyone ever encountered something like this, or know how to prevent it?

Community
  • 1
  • 1
  • 1
    If you are making a NSURL request, make sure you are using UTF8 encoding for your returned results. I was burnt with random characters in my xml for usign ascii encoding. – Sam B Aug 08 '14 at 19:40
  • Thanks for the response! Unfortunately I'm UTF8 encoding it in both my XML header: and in the NSURL delegate: NSString *responseString = [[NSString alloc] initWithData:receivedData encoding:NSUTF8StringEncoding];; – user1399378 Aug 08 '14 at 20:53

1 Answers1

0

EDIT I found the solution from another question: Remove wierd characters in xml output

You have to set the header for your content. In your example it would be text/plain I think because it's xml.

<head>
  <title>Page name</title>
  <meta http-equiv="Content-Type" content="text/plain; charset=utf-8"/>
</head>
Community
  • 1
  • 1
MrTippet
  • 306
  • 1
  • 3