I know that there are already several questions on StackOverflow about std::string
versus std::wstring
or similar but none of them proposed a full solution.
In order to obtain a good answer I should define the requirements:
- multiplatform usage, must work on Windows, OS X and Linux
- minimal effort for conversion to/from platform specific Unicode strings like
CFStringRef
,wchar_t *
,char*
as UTF-8 or other types as they are required by OS API. Remark: I don't need code-page convertion support because I expect to use only Unicode compatible functions on all operating systems supported. - if requires an external library, this one should be open-source and under a very liberal license like BSD but not LGPL.
- be able to use a printf format syntax or similar.
- easy way of string allocation/deallocation
- performance is not very important because I assume that the Unicode strings are used only for application UI.
- some example could would be appreciated
I would really appreciate only one proposed solution per answer, by doing this people may vote for their prefered alternative. If you have more than one alternative just add another answer.
Please indicate something that did worked for you.
Related questions: