-1

I've unicode character text for indian language(telugu) like this

పురాణాలు

I'm getting the above text from database to an xml file format. I'm reading the xml file and when i am printing the text it is showing as పురాణాలు

Is there any way print the text as it is without any encoded character type &#...?

Mukunda
  • 389
  • 1
  • 3
  • 9
  • 1
    What do you mean by "printing"? `NSLog(@"పురాణాలు");` outputs the expected indian characters for me. – Nikolai Ruhe Jun 12 '13 at 12:06
  • Here it is. I'm getting the value from a database as పు I want to show it as the actual text. But it is displaying correctly when put in html. – Mukunda Jun 12 '13 at 12:10
  • 3
    It sounds like you are using some software that turns characters to HTML or XML character references like `ప` and possibly does it wrong, too (there must be no space before the semicolon). Please specify the software and tools you are using. Also note that the title of the question does not match the question body and does not make sense. – Jukka K. Korpela Jun 12 '13 at 12:10
  • Yes it is coming as you said above. I'm getting the value from database as ప in xml format; – Mukunda Jun 12 '13 at 12:12
  • Seems to be an issue of XML parsing, then. The XML parser should do the conversion of masked characters. Which parser are you using? – Nikolai Ruhe Jun 12 '13 at 12:21
  • I'm using NSXmlParser to parse the xml text – Mukunda Jun 12 '13 at 12:24

1 Answers1

0

How are you parsing the XML? A proper XML parser should decode the numeric references.

I'm guessing that you are attempting to hand parse an XML document instead of relying on NSXMLParser. If so, you really should use an XML parser. Bad Guess on my part, it's likely that the entities are being double encoded.

To answer your question directly, Objective C HTML escape/unescape shows how to decode entities with a quick and dirty method.

Community
  • 1
  • 1
Jeffery Thomas
  • 42,202
  • 8
  • 92
  • 117
  • @Mukunda did you look at the SO question I referenced? http://stackoverflow.com/questions/659602/objective-c-html-escape-unescape – Jeffery Thomas Jun 12 '13 at 14:37