Boost logo

Boost :

Subject: Re: [boost] Fw: [locale] Formal review of Boost.Locale library
From: Ryou Ezoe (boostcpp_at_[hidden])
Date: 2011-04-14 12:45:21


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.

First of all, std::locale is very poorly designed.
It's useless for language like Japanese.
So anything built on top of std::locale is useless too.
This library is no exception.

Collation and Conversions is unnecessary for Japanese.
We don't have such concepts.
So I skip this.

Numbers, Time and Currency formatting and parsing
Simply replacing words is useless for Japanese.
But this is not a big problem.
The real issue is...

Messages Formatting (Translation)

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.

Further reading of the document reveals that auther of this library believes
"should use wide strings everywhere" is a myth.
http://cppcms.sourceforge.net/boost_locale/html/recommendations_and_myths.html

I strongly object about that is a myth.

Well, it's true you don't need to use wide strings, but using both
char and wchar_t is not practical.
This library treat wchar_t like a second class citizen.
We should use one encoding, one type in one program.
For a program runs on Windows OS, encoding should be UTF-16.
Because Windows' native encoding is UTF-16.
Type should be wchar_t.
Because MSVC's wchar_t encoding is UTF-16.
So we use wchar_t. All native Win32 API accept wchar_t(assuming its
encoding is UTF-16).
ANSI version of Win32 API is just a wrapper of native Wide version.
It's just not practical converting between wchar_t and char just for
passing it to the 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.

So in order to use this library, we need to store all UTF-8 encoded
string in a file and load it in runtime or convert it in runtime.
Isn't it silly we do that for using localization library?

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?
Why it hardcode char and std::string?

Hard coded char and std::string parameter is really really REALLY bad design.

I suspect auther of this library doesn't have any serious experience
in Windows programming and languages like Japanese.
What kind of joke it doesn't support Win32 API backend in MSVC?

"All of the examples that come with Boost.Locale are designed for
UTF-8 and it is the default encoding used by Boost.Locale."
Then, don't pretend it support MSVC and Windows OS in the first place!
Using UTF-8 in Windows is not a practical option.
wchar_t is NOT a second class citizen!

Sorry about my bad language.
But this library is just completely useless for the Japanese Windows programmer.
It must be rejected if this library intended to support Japanese and Windows OS.
If Boost accept this library, dropt the support of MSVC and Windows OS
so the Windows programmer knows it doesn't work for them.

--
Ryou Ezoe

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