Unsigned integer as UTF-8 value

后端 未结 4 1269
故里飘歌
故里飘歌 2021-02-03 16:46

assuming that I have

uint32_t a(3084);

I would like to create a string that stores the unicode character U+3084 which means that I

4条回答
  •  悲哀的现实
    2021-02-03 16:50

    The C++ standard contains the std::codecvt facet which converts between UTF-32 and UTF-8 according to 22.4.1.4 [locale.codecvt] paragraph 3. Sadly, the std::codecvt<...> facets aren't easy to use. At some point there was discussion about filtering stream buffers which would take case of the code conversion (the standard C++ library needs to implement them anyway for std::basic_filebuf<...>) but I can't see any trace of these.

提交回复
热议问题