i seemingly have issues with a latin1 collate on a...
# exposed
n
i seemingly have issues with a latin1 collate on a mysql database, i am translating some stuff from phph (that i not fully understand) but it seems like in exposed i get the latin1 encoded strings instead of decoded to utf8 is there any options i stil need to set in exposed ?
s
What do you mean latin1 encoded?
n
i get back
Krüger
instead of
Krüger
and i have issues with
ß
s
Probably the connection that isnt utf
We use mariadb so its a bit different but look at characterEncoding and characterSetResults properties
n
well yes the database is
latin1_swedish_ci
the question is if exposed can automatically convert it or why it does not do it ? i tried to set it in the connection url to utf8 or latin1_swedish_ci neither worked as it seems
s
Pretty sure its the mysql jdbc being useless
n
thats what i am guessing too.. alterantively i can try to convert to utf8
Copy code
String(toByteArray(Charsets.ISO_8859_1), Charsets.UTF_8)
works for everything except
ß
is
latin1_swedish_ci
a different ISO ?
s
Did you try both the properties I mentioned?
n
well.. sorry to necro this thread.. since you are using mariadb.. i am considering to make this work using mariadb, might i see the options you set for your connectionstring ? been a while sinc i could poke at this charset issue again
s
This is a part of how we configure our
HikariConfig
I think you can adapt it to your case.
Copy code
// <https://jira.mariadb.org/browse/CONJ-417>
 addDataSourceProperty("sessionVariables", listOf(
     "character_set_client=utf8mb4",
     "character_set_results=utf8mb4",
     "character_set_connection=utf8mb4",
     // <https://mariadb.com/kb/en/library/sql-mode/>
     // <https://jira.mariadb.org/browse/CONJ-545>
     "sql_mode=NO_BACKSLASH_ESCAPES"
 ).joinToString())