I have parsed some data from webpage content and stored it as an NSString. In that string there is a unicode character (\u0097). How can i remove or replace this and avoid all unicode characters?
I tried using this line but it hasn't worked:
[webpagecontent stringByReplacingOccurrencesOfString:@"\\u0097" withString:@" "];
Can anyone help me?
Thanks in advance.........
-
Sadly, there is no escape sequence that is legal C (
\u0097is not) and works in GCC. You'll have to usestringWithFormat:orstringWithCharacters:.From Peter Hosey -
If you want to "avoid all unicode characters" you could probably make an NSCharacterSet that contains everything except ASCII characters (you would want -[NSCharacterSet characterSetWithRange:]), then use -[NSString rangeOfCharacterFromSet:] and -[NSMutableString deleteCharactersInRange:] to remove the characters.
From Tom Dalling
0 comments:
Post a Comment