Bug #15797
closedtx_cms_layout->wordWrapper do not support multi-byte charset
100%
Description
wordWrapper use chunk_split. which will break multi-byte charset in the middle.
As a result, the db_layout.php of page will show many broken character
It should use wordwrap in CSS. But seem not supported by Firefox.
http://msdn.microsoft.com/workshop/samples/author/dhtml/refs/wordWrap.htm
my edition of it rewrite the logic.
And it assert all incoming character are UTF-8.
(someone please change it to fix)
--- CVS 1.28.2.2 ---
function wordWrapper($content,$max=50,$char=' ') { my edition ---
$array = split(' |'.chr(10),$content);
foreach($array as $val) {
if (strlen($val)>$max) {
$content=str_replace($val,substr(chunk_split($val,$max,$char),0,-1),$content);
}
}
return $content;
}
--
function wordWrapper($content,$max=50,$char=' ') {>csConvObj;
$segments=preg_split("/[\\b\r\n ]/",$content,-1,PREG_SPLIT_DELIM_CAPTURE);
$csConv=$GLOBALS['LANG']
foreach($segments as &$segment){
if(strlen($segment)>$max){ // quick check when it is really short
$s=$segment;
$segment='';
while($csConv->strlen('utf-8',$s)>$max){
// It should do better for wide character.
// but csConvObj do not provide that information,
// and browser can do wrap between wide characters
$segment.=$csConv->substr('utf-8',$s,0,$max);
$segment.="\r\n";
$s=$csConv->substr($s,$max);
}
$segment.=$s;
}
}
return implode('',$segments);
}
(issue imported from #M2819)