Boost logo

Boost :

Subject: Re: [boost] [General] Always treat std::strings as UTF-8? (was[Process] List of small issues)
From: Alexander Lamaison (awl03_at_[hidden])
Date: 2011-01-14 09:52:29


On Fri, 14 Jan 2011 16:09:02 +0200, Peter Dimov wrote:
> Alexander Lamaison wrote:
>
>>> On Fri, 14 Jan 2011 00:48:43 -0800 (PST), Artyom wrote:
> ...
>>> Two problems with this approach:
>>>
>>> - Even if the encoding under POSIX platforms is not UTF-8 you will
>>> be still able to open files, close them, stat on them and do any
>>> other operations regardless encoding as POSIX API is encoding
>>> agnostic, this is why it works well.
>>
>> This isn't a problem, right? This is exactly why it _does_ work :D
>> Assume
>> the strings are in OS-default encoding, don't mess with them, hand them to
>> the OS API which knows how to treat them.
>
> It doesn't always work. On Mac OS X, the paths must be UTF-8; the OS isn't
> encoding-agnostic, because the HFS+ file system stores file names as UTF-16
> (much like NTFS).

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?

Alex

-- 
Easy SFTP for Windows Explorer (http://www.swish-sftp.org)

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk