Utf-8 in c++: quick & dirty tricks

前端 未结 3 1638
梦如初夏
梦如初夏 2021-02-02 01:32

I am aware that there are been various questions about utf-8, mainly about libraries to manipulate utf-8 \'string\' like objects.

However, I am working on an \'internati

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-02 02:20

    We handle it also like this in OpenLieroX (which is really fine in a game I think).

    We have a bunch of useful functions/algorithms for such UTF-8 std::strings. See Unicode.h and Unicode.cpp. For example, there are UTF8 iterators, some simple manipulation operators (insert or erase), upper/lower case conversions, case independent search, etc.

    But don't expect those functions to be always correct. For example, they don't know really about combining diacritics or possible different ways to encode the same text.

提交回复
热议问题