My Sql-Database uses utf8_bin, which is limited to 3-Byte-Characters. Im using a pre "5.1.46" Mysql connector.
On this site: https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-charsets.html, it is stated that using the "characterEncoding=utf-8" parameter, means that it uses utf8mb3. Which would be correct in my case. The problem is, that the application will throw a Mysql-Exception when it tries to write a 4-Byte-Character:
for example:
java.sql.SQLException: Incorrect string value: '\xF0\x9F\x98\x81 \xC4...'
Furthermore, if I dont specify the characterEncoding-parameter at all, it will default to some other charset. The problem here is, that a lot of characters that I need to be able to write into the DB will just be replaced by a "?". Like "ğ" for example.
So far, the only Solution I see to this problem is just removing all 4-Byte characters from a String, before I write it into the Database, since changing the charset of the Database iself is not an option unfortunatley
But I was wondering if im missing something here. Is there better way to do this?
Thanks a lot