Question

I have a piece of NSString that will read "Test & Test" or with "

Is there any way without searching and replacing to make that display as "&" or """ ??

Was it helpful?

Solution

Can you try this ?

NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];

[request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://www.mypage.com/content.html"]]];
[request setHTTPMethod:@"GET"];

NSHTTPURLResponse* authResponse;
NSError* authError;
NSData * authData = [NSURLConnection sendSynchronousRequest:request returningResponse:&authResponse error:&authError];      

NSString *authResponseBody = [[NSString alloc] initWithData:authData encoding:NSUTF8StringEncoding];

NSLog(@" Nice Result: %@", authResponseBody);

Adrian

OTHER TIPS

CFXMLCreateStringByUnescapingEntities should do it. Thanks to the magic of toll free bridging you can just use your NSString.

The html string you read is bad formated.

Try to read as UTF-8 or any other formatting in order to get the correct text from the html you're reading.

Can you actually post the code where you read the NSString from the HTML content ?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top