简体   繁体   中英

EF Core Sqlite LIKE Unicode comparison

We have a Windows.Net Core app using Sqlite and EF Core (latest) that deals with unicode data (non-ascii characters).

As the official Sqlite docs explain ( https://www.sqlite.org/matrix/quirks.html ) by default unicode case folding is not enabled. That means that eg the LIKE operator won't do case-insensitive comparison for non-ascii characters so "ä" will NOT equal "Ä".

The official docs also mention that it's possible to enable this LIKE case-insensitive comparison for unicode by using the ICU extension. I'm having a hard time finding a compiled version of it that's usable on Windows.

So I guess I have several questions:

  1. Is there a compiled version of the ICU extension downloadable somewhere?
  2. Is there an alternative way of achieving case-insensitive unicode LIKE? I found several potential options but they either didn't work (column collation, global collation etc) or seem clunky/slow (overriding the default LIKE operator and performing a LIKE in code)

ICU is a unicode/localization library and not a sqlite extension.

A list of available sqlite extensions can be found here https://www.sqlite.org/src/file/ext/misc , and none of them support unicode search.

In order to get unicode support, you likely will need to build sqlite yourself using the SQLITE_ENABLE_ICU compile parameter. Make sure that you have ICU installed beforehand so that you can reference and link it during the build process

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM