[dev] Problems using UTF8 with some languages (accents shown like chinese characters) patch

Daniel Vandal dvandal at infoteck.qc.ca
Fri Oct 22 09:00:29 PDT 2004


Hi,

This patch add a Horde config option to set if Horde should 
automatically detect the charset to use or use the default charset set 
for the currently used language. This solve all my accents problems 
cause by horde being UTF8 instead of ISO-8859-1. (Because accents appear 
like chinese characters instead of à é â ê ...). Tested on two 
differents servers with lastest Horde cvs and with Internet Explorer and 
Mozilla and everything work as expected (when this config option is set 
to true, false by default). If set to false, chinese characters appear 
where accents are.

Daniel Vandal
dvandal at infoteck.qc.ca
-------------- next part --------------
Index: NLS.php
===================================================================
RCS file: /repository/framework/NLS/NLS.php,v
retrieving revision 1.81
diff -u -r1.81 NLS.php
--- NLS.php	19 Oct 2004 20:45:36 -0000	1.81
+++ NLS.php	22 Oct 2004 15:54:53 -0000
@@ -206,9 +206,17 @@
      * @return string  The character set that should be used with the current
      *                 locale settings.
      */
-    function getCharset($original = false)
+    function getCharset($original = null)
     {
         global $language, $nls;
+	
+	if (empty($original)) {
+	    if (!empty($GLOBALS['conf']['use_original_charset'])) {
+		$original = $GLOBALS['conf']['use_original_charset'];
+	    } else {
+		$original = false;
+	    }
+	}
 
         /* Get cached results. */
         $cacheKey = intval($original);
-------------- next part --------------
Index: conf.xml
===================================================================
RCS file: /repository/horde/config/conf.xml,v
retrieving revision 1.60
diff -u -r1.60 conf.xml
--- conf.xml	4 Oct 2004 20:25:14 -0000	1.60
+++ conf.xml	22 Oct 2004 15:53:47 -0000
@@ -51,6 +51,9 @@
   page size can be dramatic (70k to under 10k for a full mailbox page), and is
   more than worth it over anything but an extremely fast
   link.">true</configboolean>
+  <configboolean name="use_original_charset" desc="If this option is set to true, Horde
+  will always use the specified charset according to the specified language. This can
+  solve some problems displaying accents with languages like French.">false</configboolean>      
   <configinteger name="umask" octal="true" desc="What umask should we run with? This will affect the permissions on any temporary files that are created. This value is an integer.">077</configinteger>
   <configstring name="tmpdir" required="false" desc="If you want to use a
   temporary directory other than the system default or the one specified in


More information about the dev mailing list