-
-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection CharacterSet is incorrectly determined #322
Comments
Temporary workaround: Executing the following query switches the connection to use the desired charset and collation: SET NAMES 'utf8mb4' COLLATE 'utf8mb4_general_ci'; |
This is addressed by the mysql-nio rewrite I've 90% completed (and trust me, no one's more sick of hearing me say it's "almost done" for a year straight than I am 😓😆). I'll make sure this issue gets mentioned in the PR as soon as it's up. In the meantime, you can work around it by issuing an appropriate
Technical note: This is equally as much an issue caused by MySQL 5.7's epically outdated handling of Unicode as it is any fault of the (very shoddy) existing MySQLNIO implementation. For some gory details, have a look at the documentation comments I've included with the relevant logic in the MySQLNIO rewrite: https://gist.github.com/gwynne/95679fc31b6b897799684ad5b9073066. (Please note this will almost certainly not be the final code; as mentioned, the rewrite is still in progress.) P.S.: As per the comments in the Gist, you probably want to use the |
@gwynne I really appreciate the super quick response, with details (especially on a weekend 🫡) Glad to know this is being refactored and support will be landing soon.
Yes, I have a temporary workaround for this, but it'd be just cleaner to have upstream support.
I'll test with the suggested collation param and follow up shortly. I'm unable to update to MySQL 8.x immediately, but this is scheduled for December. Do you reckon this is a non-issue when running MySQL 8.x or would the workaround still be necessary until your refactor is complete? |
The single-byte collection identifier that the current version of MySQLNIO sends in the protocol Of course, that collation ID doesn't exist yet in 5.7 (or, for that matter, in even the most recent versions of MariaDB), so the server falls back on its default-configured character set instead. 5.7 has still been getting maintenance updates all this time (although it's soon to FINALLY be declared EOL and put out of its misery at long last); at some point and they changed the default for new installations (and most hosted solutions and UNIX distros in general patched that default in a much longer time ago), so even those still using it have a decent chance of lucking into a correct configuration. Unfortunately, many - such as yourself - still end up with |
Tested locally updating MySQL to v8.0.3-rc (latest supported by the OS) and I can confirm this works without any workarounds. I'll keep the workaround for my production MySQL server which I'm unable to update immediately to v8.
Yes, as per your suggestion, using I'm closing this issue, and I look forward to your updates. I appreciate your help @gwynne. |
Describe the bug
For the following query:
Sequel Pro reports the results as follows:
However, my Vapor-Fluent setup with the mysql driver reports it as follows:
Configuring the database in Vapor:
Many years ago, there was an option to set the CharacterSet on the connection, but has since been removed. I couldn't figure out a way to configure this with the latest versions of the related packages.
Due to the incorrect inferred character set, unicode characters get substituted by
?
inVARCHAR
andTEXT
fields.I'd appreciate any help debugging this issue or being able to configure the connection character set and collation params.
Environment
5.7.19
14.0
20.04.6 LTS
5.8.1
4.84.4
4.7.1
4.4.0
Related
The following issues/PRs may be related:
The text was updated successfully, but these errors were encountered: