mirror of
https://github.com/vrana/adminer.git
synced 2025-08-07 23:27:17 +02:00
Support high Unicode characters in shorten_utf8 (bug #481)
This commit is contained in:
@@ -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>");
|
||||
|
Reference in New Issue
Block a user