Change charset for certain fields to utf8mb4

The underlying cause of #419 is the default utf8 collation in MySQL/MariaDB, which only supports the base plane of Unicode (\u0000-\uffff).  By changing the collation to utf8mb4_general_ci, stuff like ban reasons and profile text may have emoji and other non-base-plane Unicode.

The charset for playlist titles is NOT changed, and non-base-plane characters are replaced by question marks.  This is because switching to utf8mb4 would make the primary key too long.
This commit is contained in:
Calvin Montgomery 2014-12-14 21:33:48 -05:00
parent 4b8681c2a4
commit 9deff9bdb1
3 changed files with 8 additions and 5 deletions

View file

@ -1243,6 +1243,8 @@ PlaylistModule.prototype.handleClonePlaylist = function (user, data) {
});
}
data.name = data.name.replace(/[^\u0000-\uffff]/g, "?");
var pl = this.items.toArray();
var self = this;
db.saveUserPlaylist(pl, user.getName(), data.name, function (err) {