Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: String Encodings and POSIX Commands



At 11:23 PM +0100 3/19/02, Eric Seidel wrote:
a.  My understanding of Darwin is that the File System uses Unicode
16byte strings, correct?

It depends on the file system. As far as I recall, HFS+ stores canonically decomposed Unicode strings in big-endian UTF-16 encoding. Other volume formats may store names differently.


b.  It is my understanding then that the commands open() and chdir() etc
are all expecting (or at least can handle) Unicode-16 strings under
Darwin?

I think all Darwin-level functions that deal with paths expect canonically decomposed Unicode strings in UTF-8 encoding. (I don't think there's any such thing as "Unicode-16".)


- On OSX/Darwin, I have been using CFString functions to read the server
strings as kCFStringEncodingWindowsLatin1, and write them to local as
kCFStringEncodingUTF8.  Is this OK?  (vice versa going from Local to
server).

I think so. You may have to pass an additional flag to make sure you get the resulting string in the decomposition that the filesystem is expecting.


Actually, looking at it, you can probably call

  TextEncoding encodingToUse = CreateTextEncoding(kTextEncodingUnicodeV3_2,
                                   kUnicodeCanonicalDecompVariant,
                                   kUnicodeUTF8Format);

to create a text encoding to pass to the CFString functions. (I think you can pass the CFString functions any TextEncoding value.) I haven't tested it and I can't warrant that it works, but it might be worth a try.

  -- Chris

--
Chris Hanson                      |  Email: email@hidden
bDistributed.com, Inc.            |  Phone: +1-847-372-3955
Mac OS X & WebObjects Consulting  |  Fax:   +1-847-589-3738
http://bdistributed.com/          |  Personal Email: email@hidden
_______________________________________________
unix-porting mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/unix-porting
Do not post admin requests to the list. They will be ignored.



References: 
 >String Encodings and POSIX Commands (From: Eric Seidel <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.