How do I properly use std::string on UTF-8 in C++?

前端 未结 4 1247
心在旅途
心在旅途 2020-12-02 05:39

My platform is a Mac and C++11 (or above). I\'m a C++ beginner and working on a personal project which processes Chinese and English. UTF-8 is the preferred encoding for thi

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-02 06:19

    Consider upgrading to C++20 and std::u8string that is the best thing we have as of 2019 for holding UTF-8. There are no standard library facilities to access individual code points or grapheme clusters but at least your type is strong enough to at least say it is true UTF-8.

提交回复
热议问题