Re: &xxx; thingies
Re: &xxx; thingies
- Subject: Re: &xxx; thingies
- From: Jeff LaMarche <email@hidden>
- Date: Sat, 17 Nov 2001 22:16:15 -0500
Here's how I did it - it doesn't require a lookup table, as long as you
know that the URL you'll be encoding only has ASCII-8 characters. I
think this will work with some extended characters, but not with the
full range of characters available in Unicode...
-(NSString *)encodeChar:(char)inChar
{
char *lookup = "0123456789ABCDEF";
return [NSString stringWithFormat:@"%%%c%c", lookup[(int)inChar /
16], lookup[(int)inChar % 16]];
}
Jeff
On Saturday, November 17, 2001, at 06:40 AM, Scott Anguish wrote:
Total lazy man hack here.. (there are better ways to do this.. but
they'd require a big table of the values to map to)
load the NSString into an NSText instance as HTML, and then grab the
string from the text.
Like I said.. TOTAL hack.. (not sure, but it might ruin any
whitespace/returns)
I'd love to see an NSEncoding mode that handled HTML so you could move
between the escaped and unescaped stuff easily...
On Saturday, November 17, 2001, at 01:50 AM, Angela Brett wrote:
Hi,
I know I could do this myself but I'm sure it's already been done.
What should I use to go through an NSString and turn the & etc
used in HTML into the characters they represent? It looks as if the
Omniweb framework can do it, but I haven't figured out how yet. I
don't really want to add all the Omni frameworks to my project just
for that, so if someone could tell me about a simple way of doing it
I'd be most grateful.
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev