how can I compare utf8 string such as persian words in c++?

后端 未结 3 656
抹茶落季
抹茶落季 2020-12-11 10:13

I want to compare strings in Persian (utf8). I know I must use some thing like L\"گل\" and it must be saved in wchar_t * or wstring. the question is when I compare by the fu

3条回答
  •  自闭症患者
    2020-12-11 11:00

    wchar_t is not for UTF-8, but (depending on the platform) typically either UTF-16 or UCS-32. If you want to work on UTF-8, use plain old char * or string, and their comparison functions for equality. If you want human-meaingful sorting, it gets much more involved (no matter which encoding you use).

提交回复
热议问题