Boost logo

Boost :

Subject: Re: [boost] Fw: [locale] Formal review of Boost.Locale library
From: Sergey Cheban (s.cheban_at_[hidden])
Date: 2011-04-14 15:24:14


14.04.2011 20:45, Ryou Ezoe пишет:

> Here is my review.
> I am Japanese.
> I use Microsoft Windows OS.
>
> Short conclusion.
> This library is badly designed and completely useless for Japanese
> language and Windows programmer.
> It must be rejected or drop support of MSVC and Windows OS.
I'm a russian windows prorgammer. My native language is russian, I know
english and have very basic knowledge about german, arabic, hebrew
chinese and japanese languages.
I disagree with you.

> This API is very badly designed.
> I really disappointed about use of hard coded char and std::string.
> It's not just output(return type) it matters.
> We, Japanese Windows programmer, natively use wchar_t.
> So input(function parameter) must support it too.
1. The native type for the strings under windows is really WCHAR, not
wchar_t.
2. According to the c++0x specification, "Type wchar_t is a distinct
type whose values can represent distinct codes for all members of the
largest extended character set specified among the supported locales".
For the MSVC compiler, the size of the wchar_t is 16 bits. So, the
wchar_t type IS a second class citizen for the MSVC compiler. It is not
a problem of the boost::locale library.

> Besides, what encoding shoud we use for char in Windows?
> It isn't fixed under the Windows and MSVC.
> MSVC doesn't support UTF-8 literal.
MSVC supports the UTF-8 literals for the source files stored as UTF-8
with byte order mark (0xEF,0xBB,0xBF).

> So, we need char set conversion between UTF-8 and UTF-16 in order to
> use this library.
> Does this library support this conversion? No.
> Why it doesn't support char set conversion between UTFs?
Agree. I see no way to convert strings between UTF-X and UTF-Y without
specifying the locale. But please note the boost.unicode library that is
under development now. It has the utf_transcoder template
(http://mathias.gaunard.com/unicode/doc/html/boost/unicode/utf_transcoder.html).
I propose to wait until the boost.unicode review and add something like
it to the boost.locale if the boost.unicode will not be accepted.

> Why it hardcode char and std::string?
The wchar_t strings seems to be supported. See boost::locale::wformat
for example. I see no problems here.

--
Sergey Cheban

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