Support utf8mb4 if the database does. Fixes #535
What MySQL calls "UTF8" is actually a subset of the full unicode specification. It doesn't accept 4-byte UTF-8 characters. Proper support is called "utf8mb4" and is, these days, fairly common (Ubuntu 10.04LTS's bundled MySQL does not support it, but later ones do) Detection of utf8mb4: "SHOW CHARACTER SET WHERE charset='utf8mb4';" returns at least one row Conversion of pre-existing DBs: this was easy, we already had code in the updater for this for when we started enforcing utf8. It was version-bumped and set to update to either utf8mb4 or utf8, depending Making it use utf8mb4 in the database connection: Actually hard. Connector/J 5.1.13 or newer should autodetect this, but in my testing it didn't (http://dev.mysql.com/doc/relnotes/connector-j/en/news-5-1-13.html) As such, if utf8mb4 has been detected, I've added code that should manually execute "SET NAMES utf8mb4;" on all new connections. If a database does not support utf8mb4 (rare these days) I've added code to strip these characters before DB insertion; they won't be recorded correctly, but it'll avoid the exception from issue #535
This commit is contained in:
1 parent
3711aa3890
commit
82b4ffc2a2
8 files changed
+62
-40
No files matched your search
@@ -1,5 +1,5 @@
|
||||
name: ${project.name}
|
||||
version: '1.91'
|
||||
version: '1.92'
|
||||
author: DiddiZ
|
||||
authors: [md_5, ammar2, frymaster]
|
||||
website: http://dev.bukkit.org/server-mods/logblock/
|
||||
|
||||
Reference in new issue
Block a user