summaryrefslogtreecommitdiff
path: root/inc/functions.php
diff options
context:
space:
mode:
authorMichael Foster <savetheinternet@tinyboard.org>2013-07-30 22:08:56 -0400
committerMichael Foster <savetheinternet@tinyboard.org>2013-07-30 22:08:56 -0400
commit8efab06616bfcdab49fb9e996cdc7ddfe79426bb (patch)
tree46f03f9ee1623c87fb8e3fe4a1f92cc1e7532b0f /inc/functions.php
parent91bb3182da63e64d45ab8ac26735e090db928f15 (diff)
Upgrade to utf8mb4 charset for MySQL server versions above 5.5.3. Keep support for older versions. Fix charsets for multiple columns and tables.
Diffstat (limited to 'inc/functions.php')
-rw-r--r--inc/functions.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/inc/functions.php b/inc/functions.php
index 4af7891a..d5692be5 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -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) {