Project

General

Profile

Actions

Bug #15797

closed

tx_cms_layout->wordWrapper do not support multi-byte charset

Added by old_hkdennis2k about 18 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Target version:
-
Start date:
2006-03-10
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
3.8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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=' ') {
$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;
}
--
my edition ---
function wordWrapper($content,$max=50,$char=' ') {
$segments=preg_split("/[\\b\r\n ]/",$content,-1,PREG_SPLIT_DELIM_CAPTURE);
$csConv=$GLOBALS['LANG']
>csConvObj;
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)

Actions #1

Updated by Oliver Hader over 12 years ago

  • Status changed from New to Closed
  • Target version deleted (0)
  • TYPO3 Version changed from 3.8.1 to 3.8
  • PHP Version deleted (4)

The reported TYPO3 version is not supported anymore. Please open a new and updated issue if you can reproduce this behavior with the most recent TYPO3 version.

Actions #2

Updated by Georg Ringer over 10 years ago

  • Status changed from Closed to Accepted

example is

使用される高性能計測機器やラボ用計器を生産しています。

Actions #3

Updated by Gerrit Code Review over 10 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22840

Actions #4

Updated by Gerrit Code Review over 10 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22840

Actions #5

Updated by Gerrit Code Review over 10 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22840

Actions #6

Updated by Gerrit Code Review over 10 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22840

Actions #7

Updated by Gerrit Code Review over 10 years ago

Patch set 1 for branch TYPO3_6-1 has been pushed to the review server.
It is available at https://review.typo3.org/22890

Actions #8

Updated by Georg Ringer over 10 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #9

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF