Fix typo ENABLE_UTF8MB -> ENABLE_UTF8MB4#1125
Merged
Merged
Conversation
taniwallach
approved these changes
Aug 28, 2020
Member
There was a problem hiding this comment.
I think both changes are correct.
The fix is needed as the code is currently inconsistent, but it seems that many systems would not notice the bug. I suspect that systems where the database is not configured to default to utf8mb4 for the connection may have issues at present.
I certainly do not encounter any issues on a Docker setup before the patch, and I could put a 4-byte UTF-8 character into a students name.
Why?
- My database is configured directly to use
utf8mb4for the connection charset, etc. usingdocker-config/db/mariadb.cnfso the bug causing a failure to callSET NAMES 'utf8mb4';is not causing trouble. - It seems that Perl's DBD when when
mysql_enable_utf8is used (instead ofmysql_enable_utf8mb4) does not really make any effort to prevent 4-byte UTF-8 characters from being passed between Perl and the database. Instead, to documentation instructs users of the limited 3-byte mySQLutf8charset that such checks are to be added by the people writing code which uses the restricted (somewhat broken)utf8character set.- https://metacpan.org/pod/DBD::mysql
- https://github.com/perl5-dbi/DBD-mysql/blob/master/lib/DBD/mysql.pm
- Note the lines (emphasis added)
When the C charset is used then you are responsible for 3-byte UTF-8 sequence checks on input perl scalar strings. Otherwise MySQL server can reject or modify the input statement!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See discussion at mikeshulman#1.