0

I've had this problem for a long time but I've been implementing this ugly hack on the backend to get around it.

Now I've decided to act as a real developer and deal with it.

My problem is that when parsing an XML feed with any of the Norwegian characters æ, ø or å in the title node, all the letters appearing before these special characters are ommitted.

So if the word is "Bålhuset" it only displays "ålhuset" - the funny thing is that æ,ø and å characters AFTER the initial problem character is included.

So if I put for example "ÅBålhuset", I will get "Bålhuset". So it seems it's only the first occurence of one of these special characters that will cause a problem.

Any help would be immensely appreciated!

-Chris

PinkFloydRocks
  • 808
  • 3
  • 14
  • 29

2 Answers2

1

Try while you creating XML use CDATA tags like

<title><![CDATA[Transport "Bålhuset"Classic World&#039;s]]></title>

Also here is a list of HTML Tags and more cases XML with those characters is invalid, unless they are contained within a CDATA. Also try this Question hope with help you

Otherwise you need to use their special character code. If you want to represent ö you need to type &ouml; please review like.

And Final XML with those characters is invalid, unless they are contained within a CDATA. You can Validate you XML while creating and easily fix the bug.

Community
  • 1
  • 1
Buntylm
  • 7,345
  • 1
  • 31
  • 51
  • Thanks for your proposal - but I've no control over the backend for this project – PinkFloydRocks May 25 '13 at 12:40
  • You can Validate your xml as given link for bug fixing after all with those characters is invalid, unless they are contained within a CDATA. – Buntylm May 25 '13 at 12:48
  • It's in UTF8 - and it also validates just fine. There is no problem parsing this XML on android, so it's got something to do with NSXMLParser's handling of international chars – PinkFloydRocks May 25 '13 at 13:03
0

What did it for me was getting the data in JSON and using the native JSON methods; no dropped characters and other sporadic behaviour.

So what that means to me is that there is an issue with NSXMLParser that makes it choke on international characters (the first occurence of which mind you) even though everything is in order with encoding etc.

PinkFloydRocks
  • 808
  • 3
  • 14
  • 29