[Vtigercrm-commits] [vtiger-commits] r9571 - in /vtigercrm/branches/5.0.1: include/utils/utils.php modules/Contacts/chat.php modules/Contacts/vtchat.php modules/Settings/UpdateComboValues.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Thu Oct 5 11:34:32 EDT 2006


Author: richie
Date: Thu Oct  5 09:34:24 2006
New Revision: 9571

Log:
UTF-8 support added . Fixes #2297

Modified:
    vtigercrm/branches/5.0.1/include/utils/utils.php
    vtigercrm/branches/5.0.1/modules/Contacts/chat.php
    vtigercrm/branches/5.0.1/modules/Contacts/vtchat.php
    vtigercrm/branches/5.0.1/modules/Settings/UpdateComboValues.php

Modified: vtigercrm/branches/5.0.1/include/utils/utils.php
==============================================================================
--- vtigercrm/branches/5.0.1/include/utils/utils.php (original)
+++ vtigercrm/branches/5.0.1/include/utils/utils.php Thu Oct  5 09:34:24 2006
@@ -838,7 +838,7 @@
         global $toHtml;
         if($encode && is_string($string)){//$string = htmlentities($string, ENT_QUOTES);
 		if (is_array($toHtml))
-        		$string = str_replace(array_keys($toHtml), array_values($toHtml), $string);
+			$string = str_replace(array_keys($toHtml), array_values($toHtml), $string);
         }
 	$log->debug("Exiting to_html method ...");
         return $string;
@@ -2618,4 +2618,40 @@
 	global $current_user,$adb;
 	return $adb->query_result($adb->query("select int_mailer from vtiger_mail_accounts where user_id='".$current_user->id."'"),0,"int_mailer");
 }
+
+/**
+* the function is like unescape in javascript
+* added by dingjianting on 2006-10-1 for picklist editor
+*/
+function utf8RawUrlDecode ($source) {
+    $decodedStr = "";
+    $pos = 0;
+    $len = strlen ($source);
+    while ($pos < $len) {
+        $charAt = substr ($source, $pos, 1);
+        if ($charAt == '%') {
+            $pos++;
+            $charAt = substr ($source, $pos, 1);
+            if ($charAt == 'u') {
+                // we got a unicode character
+                $pos++;
+                $unicodeHexVal = substr ($source, $pos, 4);
+                $unicode = hexdec ($unicodeHexVal);
+                $entity = "&#". $unicode . ';';
+                $decodedStr .= utf8_encode ($entity);
+                $pos += 4;
+            }
+            else {
+                // we have an escaped ascii character
+                $hexVal = substr ($source, $pos, 2);
+                $decodedStr .= chr (hexdec ($hexVal));
+                $pos += 2;
+            }
+        } else {
+            $decodedStr .= $charAt;
+            $pos++;
+        }
+    }
+    return $decodedStr;
+}
 ?>

Modified: vtigercrm/branches/5.0.1/modules/Contacts/chat.php
==============================================================================
--- vtigercrm/branches/5.0.1/modules/Contacts/chat.php (original)
+++ vtigercrm/branches/5.0.1/modules/Contacts/chat.php Thu Oct  5 09:34:24 2006
@@ -330,6 +330,8 @@
    */
   function submit($msg, $to=0)
   {
+    //UTF-8 support added - ding
+    $msg = utf8RawUrlDecode($msg);
     $msg = $this->msgParse($msg);
     if(strlen($msg) == 0) return;
     

Modified: vtigercrm/branches/5.0.1/modules/Contacts/vtchat.php
==============================================================================
--- vtigercrm/branches/5.0.1/modules/Contacts/vtchat.php (original)
+++ vtigercrm/branches/5.0.1/modules/Contacts/vtchat.php Thu Oct  5 09:34:24 2006
@@ -12,10 +12,10 @@
 <title>Ajax Css-Popup chat</title>
 
 <!-- NEEDED SCRIPTS  -->
-<script type="text/javascript" src="modules/Contacts/js/ajax.js"></script>
-<script type="text/javascript" src="modules/Contacts/js/dom-drag_p.js"></script>
-<script type="text/javascript" src="modules/Contacts/js/css-window_p.js"></script>
-<script type="text/javascript" src="modules/Contacts/js/chat.js"></script>
+<script type="text/javascript" charset="iso-8859-1" src="modules/Contacts/js/ajax.js"></script>
+<script type="text/javascript" charset="iso-8859-1" src="modules/Contacts/js/dom-drag_p.js"></script>
+<script type="text/javascript" charset="iso-8859-1" src="modules/Contacts/js/css-window_p.js"></script>
+<script type="text/javascript" charset="iso-8859-1" src="modules/Contacts/js/chat.js"></script>
 <!-- /NEEDED SCRIPTS -->
 
 

Modified: vtigercrm/branches/5.0.1/modules/Settings/UpdateComboValues.php
==============================================================================
--- vtigercrm/branches/5.0.1/modules/Settings/UpdateComboValues.php (original)
+++ vtigercrm/branches/5.0.1/modules/Settings/UpdateComboValues.php Thu Oct  5 09:34:24 2006
@@ -12,6 +12,8 @@
 $fld_module=$_REQUEST["fld_module"];
 $tableName=$_REQUEST["table_name"];
 $fldPickList =  $_REQUEST['listarea'];
+//changed by dingjianting on 2006-10-1 for picklist editor
+$fldPickList = utf8RawUrlDecode($fldPickList); 
 $uitype = $_REQUEST['uitype'];
 
 global $adb;





More information about the vtigercrm-commits mailing list