Take the 2-minute tour ×

I'm writing a C++ application which shall be locale independent, so I decided to use UTF-16 as my in-memory representation for strings/texts (the application should be as platform independent as possible). For localize the application's messages i want to use GNU's gettext library. Since this library seems to use GNU's libunistring library internally, i want to use this one too.

Is this a good solution for i18n, l10n? I mean it will be a lot of C code in my C++ classes (I don't found a C++ Wrapper for the libunistring library).


PS: It's my first big C++ application.

share|improve this question
Is this a gui application? If this is what toolkit are you writing it in? –  Roman A. Taycher Oct 3 '10 at 11:07
Yes, it should be a GUI application, but I want to write a command line interface first, so I dont't choosed a toolkit yet. –  Stefan Oct 3 '10 at 11:26
The question about GUI is valid, as Qt for example have built-in representation for Unicode strings (QString). And different (non-gettext) localization model. It could be easier (but not necessary better) approach. –  Paweł Dyda Oct 3 '10 at 15:29
Don't use UTF-16. Use UTF-8. –  R.. Oct 3 '10 at 16:08
@Pawel Dyda: I don't know Qt's localization model before - will have a lokk at it . –  Stefan Oct 3 '10 at 16:43

2 Answers 2

up vote 3 down vote accepted

Use UTF8 instead. see :

share|improve this answer
The libunistring library also supports UTF-8 as in-memory representation, so it's no problem to use it. Do you know a better library for doing this? The libunistring one seems to be not not so good documented. –  Stefan Oct 3 '10 at 11:30
@Downvoter: Using UTF-16 in C++ code could be problematic, especially if one needs to convert between UTF-16 and UTF-8. I don't see valid reason for downvoting this answer. –  Paweł Dyda Oct 3 '10 at 15:27

If it is a gui application written in c++, qt might be a good toolkit to do it in. It includes its own string class and its own internationalization support:


Also you can use the core non gui classes by themselves(they are in their own QtCore namespace separate form the QtGui namespace, and there are compiled to separate dynamically linked libraries).

share|improve this answer

Your Answer


