selectSQL doesn't find record if find sting start with German umlaut

I have a SQLite database with a table “countries”. This table hast two fields:
serial INTEGER
country TEXT

In SQLite or Valentina Studio, this sql query works without any problem
SELECT serial, country FROM countries WHERE LOWER(country) = ‘österreich’

In my method this doesn’t work:
var RetValue as integer
var sql as string
var CountryName as String = “österreich” // or Ägypten for Egypt

sql = “SELECT serial FROM countries WHERE country =?”

Try
rows = myDB.SelectSQL(sql, CountryName)
If rows <> Nil Then
For Each row As DatabaseRow In rows
RetValue = row.Column(“serial”).IntegerValue
Next
rows.Close
End If
return RetValue

Catch error As DatabaseException
MessageBox(CurrentMethodName + ": Error: " + error.Message)
End Try

If the country name contains a German umlaut the query works.
Example:
Dänemark
Südafrika
Rumänien

If have tried to use “CountryName.ConvertEncoding(Encodings.UTF8)”, but this doesn’t help

Are you getting an exception or just an empty rowset?

Empty rowset

This could be Unicode normalization problem. You know, the umlaut can be stored two way in Unicode.

In MBS Plugin we have a function to convert between composite and decomposition version.

People were suffering of a bug in the Format() function like this, multibyte chars were breaking the final string. Maybe related, but in the Xojo guts.