Mailing Lists: Apple Mailing Lists

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

String Encodings and POSIX Commands



I have a couple of quick questions.  I hope this is the correct forum to 
address them.

Over the past 3 months, I have designed an app for Darwin/Mac OS X using 
the POSIX API.  I slapped a cocoa interface on it and it's been ported 
to most Unixes.  Recently I ran into the problem of STRING ENCODING 
CONVERSION and have a couple of questions related:

a.  My understanding of Darwin is that the File System uses Unicode 
16byte strings, correct?

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?

c.  I am receiving string data over a network encoded in Windows Latin 1 
(ANSI codepage 1252) and I need to be sure that it is converted to the 
local File System encoding.

- 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).
(when I tried using kCFStringEncodingUnicode it balked at my straight 
ascii strings I sent the conversion function, and when I tried using 
kCFStringEncodingASCII things didn't' convert right.)  See CFString.h 
for definitions.

- Any suggestions for how to convert when running on other 
Unixes/Linuxes?  Didn't find any posix commands to handle that, nor any 
libraries on the web.

- I unfortunately wrote all my code using good old unsigned char*s 
before realizing the problem of encodings, so moving my (relative small) 
250 references to char* and associated logic to an abstracted string 
object model (similar to CFString) would be a pain.

Thank you all for your time and help.

Eric Seidel

-----------------------------------
OpenAG/OpenAG X Homepage:
http://homepage.mac.com/macdomeeu/dev/current/openag/
OpenAGs Project Page:
http://sourceforge.net/projects/openags/
_______________________________________________
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.





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.