Re: Decoding html entities
Re: Decoding html entities
- Subject: Re: Decoding html entities
- From: Conor Dearden <email@hidden>
- Date: Mon, 12 Jun 2006 10:19:38 +0200
I answered this question for someone before:
http://www.cocoabuilder.com/archive/message/cocoa/2006/5/12/163330
In your case I believe the PHP function is quite limited in its translation
and Adam is correct and all you need to do is:
NSSrting *aString = [objectDictionary objectForKey:@"name"];
NSMutableString *convertedHTMLString = [NSMutableString string];
[convertedHTMLString setString:aString];
[convertedHTMLString replaceOccurrencesOfString:@"&" withString:@"&"
options:NSLiteralSearch range:NSMakeRange(0, [convertedHTMLString length])];
[convertedHTMLString replaceOccurrencesOfString:@"""
withString:@"\"" options:NSLiteralSearch range:NSMakeRange(0,
[convertedHTMLString length])];
[convertedHTMLString replaceOccurrencesOfString:@"<" withString:@"<"
options:NSLiteralSearch range:NSMakeRange(0, [convertedHTMLString length])];
[convertedHTMLString replaceOccurrencesOfString:@">" withString:@">"
options:NSLiteralSearch range:NSMakeRange(0, [convertedHTMLString length])];
[convertedHTMLString replaceOccurrencesOfString:@"'"
withString:@"'" options:NSLiteralSearch range:NSMakeRange(0,
[convertedHTMLString length])];
//Now you have a convertedHTMLString
NSLog(@"Converted string: `%@`", convertedHTMLString);
Conor
http://www.bruji.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden