• 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: Bertrand Mansion <email@hidden>
  • Date: Sun, 25 Jul 2004 21:17:17 +0200

Nick Zitzmann wrote:

>
>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

I considered this solution but are you sure that the function
CFStringConvertEncodingToNSStringEncoding() can be relied upon ?

For example, there is a kCFStringEncodingISOLatin9 in CFStringEncoding but no
equivalent in NSStringEncoding. Will the function result default to something
else than the requested encoding ? I couldn't see any mention of this info in
the documentation.

Bertrand Mansion
Mamasam
http://www.cocoabuilder.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.


References: 
 >Re: ISO 8859-15 (Latin 9) Euro symbol and more (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: Re: cocoa-dev digest, Vol 2 #4549 - 16 msgs
  • Next by Date: NSTextView Ruler Styles
  • 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