Re: ISO 8859-15 (Latin 9) Euro symbol and more
Re: ISO 8859-15 (Latin 9) Euro symbol and more
- Subject: Re: ISO 8859-15 (Latin 9) Euro symbol and more
- From: Nick Zitzmann <email@hidden>
- Date: Sun, 25 Jul 2004 12:14:11 -0600
On Jul 25, 2004, at 11:45 AM, Bertrand Mansion wrote:
Here is the function I came up with but I don't know Carbon and CF at
all so it
might leak or even not function correctly so any input on if I should
use
CFRelease or save a CFStringGetBytes() call are welcome :)
I think doing something like this would be much cleaner: (warning -
written in Mail, untested)
@implementation NSString (Extensions)
+ (id)stringWithCString:(const char *)string
cfEncoding:(CFStringEncoding)encoding
{
return [[[self alloc] initWithCString:string cfEncoding:encoding]
autorelease];
}
- (id)initWithData:(NSData *)data cfEncoding:(CFStringEncoding)encoding
{
return [self initWith
Data:data
encoding:CFStringConvertEncodingToNSStringEncoding(encoding)];
}
- (id)initWithCString:(const char *)string
cfEncoding:(CFStringEncoding)encoding
{
return [self initWith
Data:[NSData dataWithBytes:string
length:strlen(string)] cfEncoding:encoding];
}
@end
That should give you a lot more flexibility when dealing with different
encodings.
Nick Zitzmann
<
http://www.chronosnet.com/>
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.