Compare strings with Swedish characters


I have been searching a lot for how to compare strings in a n1ql query.
I am using Couchbase 6.5 currently but when i started to check the buckets it looks like this never worked for me. My guess is that the issue is with (from the documentation):
String comparison is done using a raw-byte collation of UTF-8 encoded strings (sometimes referred to as binary, C, or memcmp). This collation is case sensitive

select meta().id, username from userdata where username = “David” -> This works fine since no Swedish characters
select meta().id, username from userdata where username = “Åke” -> The documents that has usename = “Åke” will not be found.

I am not sure how to get around this - if i should change the encoding of the string from python to make this work or make the search in n1ql in another way.
I am using the python SDK for my application and python version 3.7



The documentation is right.

See if FTS index and FTS search works for you instead of N1QL.


Found the real issue - compare string from python using couchbase is not an issue but… if you use a mac and the string comes from a filename (my case) you will have an issue. This is not a couchbase issue but more of an issue with UTF-8 on macos
I had to add:
name = normalize(‘NFC’, filename) to get it to work.


It works on 6.5 query UI
select meta().id, name from username where name = “Åke”;
“id”: “1”,
“name”: “Åke”

This is because I copy pasted the exact string as is in both the query and from the document, so the encoding is the same. See the last comment from Marco in the forum post - Couchbase sorting Swedish Å Ä Ö in the wrong order