[Vtigercrm-developers] New patch for utf-8 characters (ticket 2876)
ding jianting
dfar2008 at gmail.com
Mon Feb 19 03:42:42 PST 2007
The latest code of utf8RawUrlDecode in utils.php:
function utf8RawUrlDecode($str) {
$str = rawurldecode($str);
preg_match_all("/(?:%u.{4})|&#x.{4};|&#\d+;|.+/U",$str,$r);
$ar = $r[0];
foreach($ar as $k=>$v) {
if(substr($v,0,2) == "%u")
$ar[$k] = iconv("UCS-2","UTF-8",pack("H4",substr($v,-4)));
elseif(substr($v,0,3) == "&#x")
$ar[$k] = iconv("UCS-2","UTF-8",pack("H4",substr($v,3,-1)));
elseif(substr($v,0,2) == "&#") {
//echo substr($v,2,-1)."<br>";
$ar[$k] = iconv("UCS-2","UTF-8",pack("n",substr($v,2,-1)));
}
}
$str1 = join("",$ar);
$str1 = nl2br($str1);
return $str1;
}
above code is able to solve problems for the ajax edit with utf characters.
On 2/19/07, Erik Bent <erik at bentware.nl> wrote:
>
> Hello team,
>
> I finally found a solution for the ajax edit with utf characters (I
> hope). The entered text is transformed to a string without % character
> (in dtlviewajax.js: % => |) and then send to php (routine
> utf8RawUrlDecode in utils.php). There the | character is translated to %
> and the %XX and %uXXXX are translated to characters.
> I have used html_entity_decode to convert Ώ back to unicode for php
> 5 (according to www.php.net). In php 4 the text stays Ώ but on the
> screen the correct character is displayd (Ώ).
>
> Regards,
> Erik
> _______________________________________________
> Reach hundreds of potential candidates - http://jobs.vtiger.com
--
________________________________________
中国开源客户关系管理系统: http://www.c3crm.com
-----------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20070219/44be0c1d/attachment-0004.html
More information about the vtigercrm-developers
mailing list