In my application while parsing the XML I have a string in the foundcharacters delegate of XML parser. The actual string is ‘Aoyama-itchōme Station’ but when I apply the encoding I get it as ‘ōme Station’. The first part of the string is lost. I tried different encodings but nothing worked for me. Does anyone have an idea about what is the cause?
Here is my code:
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
if(titleFlag)
{
if(string)
{
objPlace.title = [string stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
}
}
}
‘Aoyama-itch ōme Station‘ is the string what you are getting is ‘ōme Station‘.
I guess when parsing the string is getting the first part ‘Aoyama-itch’ in the initial parsing and the second part ‘ōme Station’. What you are doing is setting it to title.
So on initial parsing when parser finds charachters…
and in second set of availability…
that is what you are seeing. So make the title object an NSMutableString object.