Upgrade to utf8mb4 charset for MySQL server versions above 5.5.3. Keep support for older versions. Fix charsets for multiple columns and tables.

This commit is contained in:
Michael Foster
2013-07-30 22:08:56 -04:00
parent 91bb3182da
commit 8efab06616
6 changed files with 202 additions and 87 deletions

View File

@@ -1399,6 +1399,9 @@ function markup(&$body, $track_cites = false) {
$body = str_replace("\r", '', $body);
$body = utf8tohtml($body);
if (mysql_version() < 50503)
$body = mb_encode_numericentity($body, array(0x010000, 0xffffff, 0, 0xffffff), 'UTF-8');
foreach ($config['markup'] as $markup) {
if (is_string($markup[1])) {
$body = preg_replace($markup[0], $markup[1], $body);
@@ -1523,7 +1526,7 @@ function markup(&$body, $track_cites = false) {
}
function utf8tohtml($utf8) {
return mb_encode_numericentity(htmlspecialchars($utf8, ENT_NOQUOTES, 'UTF-8'), array(0x010000, 0xffffff, 0, 0xffffff), 'UTF-8');
return htmlspecialchars($utf8, ENT_NOQUOTES, 'UTF-8');
}
function ordutf8($string, &$offset) {