Re: Displaying different languages in an NSTableView
Re: Displaying different languages in an NSTableView
- Subject: Re: Displaying different languages in an NSTableView
- From: Andreas Mayer <email@hidden>
- Date: Sun, 13 Oct 2002 15:50:05 +0200
Am Sonntag, 13.10.02 um 08:43 Uhr schrieb Michael James:
So my question is is there a way to determine if the string you're
about to read is encoded using Unicode, ASCII, or something else?
Not really. But you may try to use UTF8 and if it fails to decode it
must be something else. It's quite unlikely that some non-unicode
String will decode without errors (and be different from the ASCII
version).
That said, I'm not sure how to do this in cocoa. NSString's
initWith
Data:encoding: says "data must be an NSData object containing
bytes in encoding". Looks like there is no way to know if the decoding
worked. :-/
But there's some sample code at the unicode site that shows how to use
UTF8. It's plain C so you should be able to use it without to much
problems. Oh - if you got it working - I could use that one too. ;-)
Of course, if it is *not* UTF8, it may be one of a dozen other 8-bit
encodings. And those are way more difficult to differentiate between ...
bye. Andreas.
_______________________________________________
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.