I've got a PostgreSQL database that uses the UTF8 encoding. I believe this is the default encoding.
I've got a GUI application that issues a typical SELECT query, with a WHERE clause. The query is parameterized, and the content of the parameter is usually pasted in by the end user. The value is not read from a text file, etc - it's pasted into a memo edit.
Here is the query ...
cmd.CommandText = @"SELECT history_id, emplid, displayname
FROM ""MAX_HISTORY_IDS""
WHERE searchname ILIKE :searchname";
cmd.Parameters.Add("searchname", PgSqlType.VarChar).Value = "Sievert,Jürgen";
In the above code, the parameter value, Sievert,Jürgen, would be a variable parsed out of a memo edit box, or text input, etc. That name is also a real example of a name causing this query to result in an invalid UTF8 byte sequence error, from Postgre.
Now, I assume the UTF8 encoding, on the database, is fine and is pretty standard for this kind of content. What's wrong here? Is the encoding of this text parameter not UTF8? How can I get this query to work, or is the encoding on the database not suitable?