Encoding produces different result when SQLDatabaseMBS is used

So I got that inherited desktop project making extensive use of a mySQL database. Because of the troubles with Windows TLS access, I am testing SQLDatabaseMBS now which handles the problems if I use a SQLConnectionMBS to connect.

Sadly, I had to realise now the encoding of strings is broken. The original developer did not set the database’s collation to UTF8 (let it at the default latin1_swedish_ci instead), and while an editor like TablePlus shows encoding garbage, the correct encoding would be present with a DefineEncoding when Xojo’s mySQLCommunity plugin was being used.
This is not so with SQLDatabaseMBS. Retrieved Strings look exactly broken like in the db editor. I tried a set Names UTF8 when opening the connection, but that does not change anything.
Any ideas how I could fix this?

How to convert a MySQL database to UTF-8 (a2hosting.ca) describes a method to change a database encoding. Unfortunately the text is not dated, can’t tell if that still stands true.

Maybe others can suggest another process that is sure to succeed. What ever method you pick, properly backup your database BEFORE proceeding !

Sounds strange. The SQLAPI plugin requests unicode from server, so server should translate Swedish codepage to UTF-8 here.

Anyway, changing database to UTF-8 for all fields and tables may be a good idea.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.