开发者

NSXMLParser and the "£" symbol

Hey 开发者_如何学JAVAall, slight problem when i read in an XML form. NSXMLParse correctly see's the "£" symbol but its prints out the unicode, \U00a3.

I am just reading it to a string.

   [pre_Currency appendString:[self cleanString:string]];

CleanString removes \n - \t and i even added parsing out the unicode and replace it with the Char symbol for the "£".

Oddly enough a NSLog here print a "£" symbol, but when it didEndElement i add it to the dictionary,

    [number setObject:[self cleanString:pre_Currency] forKey:@"pre_currency"];

It add it as a unicode Char.

Cant understand why, looking at google theres very little aimed at parsing unicode chars.


I dont know but might be useful to you,if you use the stringByReplacingOccurrencesOfString method

NSString *specialChars=@"YOur string with special characters."

specialChars=[specialChars stringByReplacingOccurrencesOfString:@"\U00a3" withString:@"£"];

Thanks


Yes, it happens for symbols and for other languages fonts in they are not in english, I also got reply here that we will have to decode it as follows:

int c = ... /* your 4 text digit unicode ordinal converted to an integer */
charString = [ NSString stringWithFormat:@"%C", c ];

Original link - How to display Text in Arabic in UIlabel

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜