Use utf8mb4 as pymysql client charset in default env #534
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.
When investigating #341 using the boilerplate
.env-distconnection strings locally, it shows that the defaults used for connecting to mariadb would triggerDataError("Incorrect string value") exception with certain content posted:It turns out I was able to post either Latin-ext or non-Latin Unicode scripts successfully, or use e.g. a heart ❤️ emoji — however the app would crash if I tried anything more astral as facepalming 🤦 monkeys 🙈 et al. …
(passed:)

(crashed:)

The default
charset=utf8used is actuallyutf8mb3, not fullutf8mb4, so that effectively rules out emoji etc.:/ — TL;DR: https://forum.djangoproject.com/t/ticket-18392-and-mysql-utf8mb4/34916This won't magically fix production tables and collation for mb4 storage, but is currently needed for the Django versions used to at least stop crashing on such content locally.
Passing this arg to
dj_database_urlhere expands it into OPTIONS correctly, as can be seen below running this tweak locally and being able to insert emoji: … ;)