]> git.wh0rd.org - tt-rss.git/blobdiff - lib/gettext/gettext.inc
lib: Upgrade php-gettext from 1.0.11 to 1.0.12
[tt-rss.git] / lib / gettext / gettext.inc
index 00b966692cc7d16e1acc19ed21bd0e1fd3afa46c..c9f7dc01681a26f2a53d9219edfaf3d6eb807b0a 100644 (file)
@@ -174,14 +174,13 @@ function _get_codeset($domain=null) {
  * Convert the given string to the encoding set by bind_textdomain_codeset.
  */
 function _encode($text) {
+  $target_encoding = _get_codeset();
+  if (function_exists("mb_detect_encoding")) {
     $source_encoding = mb_detect_encoding($text);
-    $target_encoding = _get_codeset();
-    if ($source_encoding != $target_encoding) {
-        return mb_convert_encoding($text, $target_encoding, $source_encoding);
-    }
-    else {
-        return $text;
-    }
+    if ($source_encoding != $target_encoding)
+      $text = mb_convert_encoding($text, $target_encoding, $source_encoding);
+  }
+  return $text;
 }