D
D
diegocoder2015-11-28 04:15:19
C++ / C#
diegocoder, 2015-11-28 04:15:19

What library to use to work with UTF-8?

In general, the answer to this question already exists: grigory.info/UTF8Strings.About.html
The problem is that this library is released under the GNU GPL license. I'm looking for a similar library but under a normal license (MIT for example). Without wstring and other nasty things, you just need a unicode-enabled string class. So that the strings of this class can be used in the same way as regular C++ string. Once again I repeat - similar to the one that is available at the link above. Google gives out a monstrous ICU and stuff like that, but I haven’t found something simple like this library.
Also, your own experience of implementing unicode in your projects will not interfere.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
maaGames, 2015-11-28
@maaGames

Why do you need UTF-8? Using UTF-8 at runtime is at least inefficient, at most stupid.
wstring is a string class that supports unicode.
UTF-8 is not unicode. This is a format for converting unicode characters to 8 bit character sets. They are sooooo inconvenient to work with (even to compare characters, you have to use special functions). To store UTF-8 at runtime, you can use the "normal" std::string.
But for saving to disk, it may be more efficient to convert Unicode strings to UTF-8 if most of the text is written in English. Otherwise, you can save in Unicode, there will be no difference in file size.

O
Oleg Tsilyurik, 2015-11-28
@Olej

If it's Linux:
- if you don't need context lookup, STL find statement, etc., then in C++ string is more than enough for storing and manipulating UTF-8
- if you need lookup and context parsing at all, then it's wstring, wchar_t etc. - this is specially designed to represent Unicode in C++
- if you need some kind of char <-> wchar_t conversion, then for this you have a group of functions "multibyte characters" mb*()
And if you have Windows ... then that's it related to Unicode - through the ass and ... "I mourn with you" ;-)
(in earlier Windows Microsoft took Unicode as UTF-16, in the latest I don't know ... God bless)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question