From: garvinhicking Date: Thu, 20 Jul 2006 10:48:52 +0000 (+0000) Subject: mb_detect_encoding serously screws up on distinguisung ISO-8859-1 from UTF-8. So... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=b01420caf84b77db4a1b04e58c997a12d7f16bc9;p=s9y.git mb_detect_encoding serously screws up on distinguisung ISO-8859-1 from UTF-8. So we use the charset that s9y has configured for us. --- diff --git a/include/lang.inc.php b/include/lang.inc.php index a788808..1b606a8 100644 --- a/include/lang.inc.php +++ b/include/lang.inc.php @@ -65,7 +65,7 @@ if (!defined('serendipity_MB_LOADED') && defined('serendipity_LANG_LOADED')) { case 'ucfirst': // there's no mb_ucfirst, so emulate it if ($mbstring === 2) { - $enc = mb_detect_encoding($args[1]); + $enc = LANG_CHARSET; return mb_strtoupper(mb_substr($args[1], 0, 1, $enc), $enc) . mb_substr($args[1], 1, mb_strlen($args[1], $enc), $enc); } else { return ucfirst($args[1]); diff --git a/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php b/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php index 5ad5603..3646c9d 100644 --- a/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php +++ b/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php @@ -151,7 +151,7 @@ class serendipity_plugin_comments extends serendipity_plugin if ($sql && is_array($sql)) { foreach($sql AS $key => $row) { if (function_exists('mb_strimwidth')) { - $comment = mb_strimwidth(strip_tags($row['comment']), 0, $max_chars, " [...]", mb_detect_encoding($row['comment'])); + $comment = mb_strimwidth(strip_tags($row['comment']), 0, $max_chars, " [...]", LANG_CHARSET); } else { $comments = wordwrap(strip_tags($row['comment']), $max_chars, '@@@', 1); $aComment = explode('@@@', $comments); @@ -176,7 +176,7 @@ class serendipity_plugin_comments extends serendipity_plugin if (function_exists( 'mb_strimwidth')) { $pos = 0; $parts = array(); - $enc = mb_detect_encoding($comment); + $enc = LANG_CHARSET; $comment_len = mb_strlen($comment, $enc); while ($pos < $comment_len) { $part = mb_strimwidth($comment, $pos, $wordwrap, '', $enc);