
On Fri, 14 Jan 2011 17:04:19 +0200, Peter Dimov wrote:
Alexander Lamaison wrote:
Presumably, Mac OS X returns paths in the same encoding as it expects to receive them? So just passing them around and eventually back to the OS will always work regardless of encoding?
Yes, it does (because it's UTF-8). It doesn't work on Windows in general - if the file name contains characters that can't be represented in the default code page, they are replaced by something else, typically '?', sometimes the character without the acute mark. Either way, the name can no longer be used to refer to the original file.
Only if you modify the string! Windows can't give you a narrow string in the first place that it can't accept back. Even if you up-convert it to something like UTF-16 but don't modify it, you should always be able to down-convert back to the default codepage if you didn't modify the string.