using own squirrelmail functions for encoding/decoding instead of xml functions.
authortokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 14 Nov 2004 17:36:37 +0000 (17:36 +0000)
committertokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 14 Nov 2004 17:36:37 +0000 (17:36 +0000)
fixes bug.655137

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@8373 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/abook_ldap_server.php

index fe0fff455326899151f5bd4a13a079e3d22263f5..c8848bc13a563c0fd6bb55f71dd52e9b41aa6a92 100644 (file)
@@ -207,19 +207,16 @@ class abook_ldap_server extends addressbook_backend {
      * @return string encoded string
      */
     function charset_encode($str) {
-        if($this->charset == 'utf-8') {
-            if(function_exists('utf8_encode')) {
-                return utf8_encode($str);
-            } else {
-                return $str;
-            }
+        global $default_charset;
+        if($this->charset != $default_charset) {
+            return charset_convert($default_charset,$str,$this->charset,false);
         } else {
             return $str;
         }
     }
 
     /**
-     * Decode from charset used by this LDAP server to html entities
+     * Decode from charset used by this LDAP server to charset used by translation
      *
      * Uses squirrelmail charset_decode functions
      * @param string string that has to be decoded
@@ -228,7 +225,7 @@ class abook_ldap_server extends addressbook_backend {
     function charset_decode($str) {
         global $default_charset;
         if ($this->charset != $default_charset) {
-            return charset_decode($this->charset,$str);
+            return charset_convert($this->charset,$str,$default_charset,false);
         } else {
             return $str;
         }