]> git.mjollnir.org Git - s9y.git/commitdiff
mb_detect_encoding serously screws up on distinguisung ISO-8859-1 from UTF-8. So...
authorgarvinhicking <garvinhicking>
Thu, 20 Jul 2006 10:48:52 +0000 (10:48 +0000)
committergarvinhicking <garvinhicking>
Thu, 20 Jul 2006 10:48:52 +0000 (10:48 +0000)
include/lang.inc.php
plugins/serendipity_plugin_comments/serendipity_plugin_comments.php

index a788808ee2b72a77de98a644ca5f24c80df174dc..1b606a814fb91c45da27dfa60d33afa4af85a25f 100644 (file)
@@ -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]);
index 5ad5603c6c8989bacb10d8a7962723ae224dba6c..3646c9d0250059e8b3987b8253f628f8cbc6e83c 100644 (file)
@@ -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);