3 ms·
There is one, it is called std::string. It works fine as a container of utf8 code units. What other string type do you have in mind? Well,there is also wstring
by gpderetta 11y ago
There is one, it is called std::string. It works fine as a container of utf8 code units. What other string type do you have in mind?
Well,there is also wstring, but you should just pretend it doesn't exist.
- PopsiclePete 11y agoI don't think std::string is fine. Yes, it stores bytes, and yes, UTF-8 is byte-oriented, but besides being a storage of bytes, std::string has nothing that is unicode code-point aware. You need external libraries like ICU for that.
- gpderetta 11y agoOh, std::string is very far from being perfect for sure and the almost non-existent Unicode support in the standard library is consistent with its general lack of features. As it the case in C++, you have to resort to 3rd party library for anything beyond the very basic. ICU is very good though. There is also boost.Locale which is more "modern" and utf8 oriented although less featurefull. I was merely pointing out that saying that C++ has 8 string types is flatly wrong.