]> git.joonet.de Git - adminer.git/commitdiff
Support high Unicode characters in shorten_utf8 (bug #481)
authorJakub Vrana <jakub@vrana.cz>
Mon, 20 Feb 2017 15:22:30 +0000 (16:22 +0100)
committerJakub Vrana <jakub@vrana.cz>
Mon, 20 Feb 2017 15:22:30 +0000 (16:22 +0100)
adminer/include/functions.inc.php

index ee861f06af0c55a91a49672c2a36d5ca1580d085..97027f6543d445d0cc8e79396a95714a8ef12c1e 100644 (file)
@@ -750,7 +750,7 @@ function is_utf8($val) {
 * @return string escaped string with appended ...
 */
 function shorten_utf8($string, $length = 80, $suffix = "") {
-       if (!preg_match("(^(" . repeat_pattern("[\t\r\n -\x{FFFF}]", $length) . ")($)?)u", $string, $match)) { // ~s causes trash in $match[2] under some PHP versions, (.|\n) is slow
+       if (!preg_match("(^(" . repeat_pattern("[\t\r\n -\x{10FFFF}]", $length) . ")($)?)u", $string, $match)) { // ~s causes trash in $match[2] under some PHP versions, (.|\n) is slow
                preg_match("(^(" . repeat_pattern("[\t\r\n -~]", $length) . ")($)?)", $string, $match);
        }
        return h($match[1]) . $suffix . (isset($match[2]) ? "" : "<i>...</i>");