Fix shorten_utf8

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@920 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-07-27 16:59:52 +00:00
parent 6c97b80630
commit fa7b86ca04

View file

@ -251,7 +251,7 @@ function is_utf8($val) {
}
function shorten_utf8($string, $length = 80, $suffix = "") {
preg_match("~^(.{0,$length})(.?)~su", $string, $match);
preg_match("~^((?:.|\n){0,$length})(.|\n)?~u", $string, $match); // ~s causes trash in $match[2] under some PHP versions
return htmlspecialchars($match[1]) . $suffix . ($match[2] ? "<em>...</em>" : "");
}