• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Decoding html entities
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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:@"&amp;" withString:@"&"
options:NSLiteralSearch range:NSMakeRange(0, [convertedHTMLString length])];

    [convertedHTMLString replaceOccurrencesOfString:@"&quot;"
withString:@"\"" options:NSLiteralSearch range:NSMakeRange(0,
[convertedHTMLString length])];

    [convertedHTMLString replaceOccurrencesOfString:@"&lt;" withString:@"<"
options:NSLiteralSearch range:NSMakeRange(0, [convertedHTMLString length])];

    [convertedHTMLString replaceOccurrencesOfString:@"&gt;" withString:@">"
options:NSLiteralSearch range:NSMakeRange(0, [convertedHTMLString length])];

    [convertedHTMLString replaceOccurrencesOfString:@"&#039;"
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

  • Prev by Date: Colour Palette Design
  • Next by Date: audio output
  • Previous by thread: Re: Decoding html entities
  • Next by thread: Re: Decoding html entities
  • Index(es):
    • Date
    • Thread