ICU vs Boost Locale in C++

user1237077 picture user1237077 · Feb 29, 2012 · Viewed 11.1k times · Source

I'm considering using ICU or Boost Locale.

What are the pros and cons of each?

I understand both use ICU, but ICU is hidden by Boost Locale. According to Boost Locale's rationale page: "...the entire ICU API is hidden behind opaque pointers and users have no access to it."

Please consider new Unicode features in C++11 when comparing these libraries.

Answer

Artyom picture Artyom · Mar 16, 2012

ICU is very good library but it has drawbacks:

  1. The API is horrible in terms of modern C++ design and it does not work well with the standard C++ library
  2. It is UTF-16 oriented
  3. It's message translation tools are far from perfect, that is why Boost.Locale uses Gettext model

See: http://www.boost.org/doc/libs/1_49_0/libs/locale/doc/html/rationale.html#why_icu

Boost.Locale makes Localization in C++ way and also allows to uses other back-ends besides ICU (of course ICU is better) such that in many cases Boost.Locale provides you better localization alternative as it is simpler, designed for modern C++ and generally easier to use.

Of course if you need very sophisticated algorithms that are not supported by Boost.Locale or all what is your application does is Unicode processing then ICU may be better, other than that Boost.Locale is better for localizing C++ applications.