Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2005-05-18 15:53:16


"Vladimir Prus" <ghost_at_[hidden]> wrote in message
news:200503311322.33735.ghost_at_cs.msu.su...
> On Wednesday 23 March 2005 18:07, Beman Dawes wrote:
>> CVS now contains a branch "i18n" of the filesystem directories:
>>
>> ...
>>
>> * The POSIX wpath implementation assumes that UTF-8 is always the
>> operating
>> system's preferred external path encoding. If any Boost users are
>> concerned
>> about other encodings, please let me know.
>
> I certainly do. The standard encoding for russian on Linux is koi8-r.
> Probably, we need to use the conversion facet that's part of global
> locale.
> Qt uses
>
> char *charset = nl_langinfo (CODESET);
>
> and values of LC_ALL, LC_CTYPE and LC_LANG variables. But then it contains
> its
> own translation tables. So using locale("") is the best guess, I think.

OK, I've added wpath_traits::imbue() functions so the user can control the
locale to get the conversion facet. If the user doesn't call imbue(), the
default will be the global locale at the time of first use of a wpath
conversion. But see below.

> So using locale("") is the best guess, I think.

After reading the C++, C, and POSIX standards, I would say you are right.
But wide_test got a conversion failure from the codecvt facet on the Mac.
Ditto for the global locale. I haven't tested on POSIX yet. (See aside,
below) I gave up and changed wide_test to imbue() a locale with the Boost
UTF8 codecvt facet. That allows testing to produce uniform results on all
platforms, so is OK for testing, and also tests the imbue mechanism itself.

--Beman

<aside> I've ordered a KWM switch (with attached cables, only $28) so I
won't have to crawl around on the floor every time I want to switch between
Mac and Linux test machines. Couldn't believe how cheap they have gotten.
Ditto dual-monitor video cards and 17" LCD monitors - 17" LCD down to $209
US at Dell, including shipping! If you aren't running a dual monitor rig,
you are missing a lot of programming productivity, IMO. Run your IDE or
editor on one monitor, reference material on the other. Wonderful setup.
</aside>


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