Mailing Lists: Apple Mailing Lists

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

Translating filenames for command line?



I'm writing a Cocoa app that calls a number of command line tools via
system(). Some of the calls (to ditto, for example) use file paths obtained
from Cocoa (NSDirectoryEnumerator, for example). I'm having trouble with any
path that contains unusual characters, such as bullets or ellipses.

The command line seems to want these characters represented as numerical
equivalents (I'm presuming Unicode or ASCII?). For example, when I get the
shell to auto-complete one of these filenames it represents a bullet as
"\342\200\242" and an ellipsis as "\342\200\246".

However, when these paths are generated by Cocoa the characters are
represented normally. This causes ditto to generate an error, claiming the
file can't be found (and displaying the filename: the ellipses actually
appear there, but the bullets are shown as Yen symbols).

How do I convert Cocoa's characters to the proper numerical equivalents so
the command line tools don't choke?

Thanks,
--Dave




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.