• 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: ISO 8859-15 (Latin 9) Euro symbol and more
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 initWithData:data encoding:CFStringConvertEncodingToNSStringEncoding(encoding)];
}

- (id)initWithCString:(const char *)string cfEncoding:(CFStringEncoding)encoding
{
return [self initWithData:[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.


  • Follow-Ups:
    • Re: ISO 8859-15 (Latin 9) Euro symbol and more
      • From: Bertrand Mansion <email@hidden>
References: 
 >Re: ISO 8859-15 (Latin 9) Euro symbol and more (From: Bertrand Mansion <email@hidden>)

  • Prev by Date: Re: What's with this "new"?
  • Next by Date: Re: Array index out of bounds...
  • Previous by thread: Re: ISO 8859-15 (Latin 9) Euro symbol and more
  • Next by thread: Re: ISO 8859-15 (Latin 9) Euro symbol and more
  • Index(es):
    • Date
    • Thread