|
Boost : |
Subject: Re: [boost] [General] Always treat std::strings as UTF-8?
From: Alexander Lamaison (awl03_at_[hidden])
Date: 2011-01-14 10:14:25
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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk