Case-insensitive UTF-8 string collation for SQLite (C/C++)

前端 未结 6 804
一个人的身影
一个人的身影 2021-02-09 04:58

I am looking for a method to compare and sort UTF-8 strings in C++ in a case-insensitive manner to use it in a custom collation function in SQLite.

  1. The method shou
6条回答
  •  北恋
    北恋 (楼主)
    2021-02-09 05:34

    I have no definitive answer in the form of example code, but I should point out that an UTF-8 bytestream contains, in fact, Unicode characters and you have to use the wchar_t versions of the C/C++ runtime library.

    You have to convert those UTF-8 bytes into wchar_t strings first, though. This is not very hard, as the UTF-8 encoding standard is very well documented. I know this, because I've done it, but I can't share that code with you.

提交回复
热议问题