Subject: Re: [boost] Review Request: Boost.Locale
From: Artyom (artyomtnk_at_[hidden])
Date: 2010-05-24 02:10:42
> One thing in particular that I was interested in is(are)
> I didn't any thing on this. Why is
Take a look on http://www.cplusplus.com/reference/std/locale/codecvt/
They allow you to imbue special charset to fstream and automatically
translate wide characters to normal encoding like UTF-8 or ISO-8859-8.
> Is this a separate
> subject or is that you believe they're not useful.Â
Theoretically they are very useful.
fs << L"×©×××"!
Would print UTF-8 output.
- Many compilers/standard libraries do not implement locales at all.
(GCC under Windows and Solaris, STL Port library)
- Support of locales and encoding is strictly limited to OS
configuration. So on some host the above example would work on other
it would throw invalid locale error.
- Some compilers/OSes do not support UTF-8 encodings (MSVC) so
you can't create UTF-8 locale at all.
- Locales name are platform depended. For example under Windows
you need Hebrew_Israel.1255 locale and under Linux he_IL.ISO-8859-8
(and BTW 1255!=iso-8859-8)
So Boost.Locale reimplements standard codecvt facet to make this work
on any platform.
However there is still a limitation when working with 2 byte
characters (ie char16_t or wchar_t under windows) as Boost.Locale
would work correctly only with UCS-2
But this is actually C++ standard's limitation.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk