Bug #15797

tx_cms_layout->wordWrapper do not support multi-byte charset

Added by old_hkdennis2k over 13 years ago. Updated 12 months ago.

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

100%

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)

Associated revisions

Revision 196e885d (diff)
Added by Georg Ringer about 6 years ago

[BUGFIX] Use proper implementation of a wordwrap

The page module uses a custom implementation of a wordwrap
as this was not supported by the browser in those earlier days.

The big drawback is that there is no UTF8 support for this which
leads to empty preview boxes when e.g. using Japanese.

Change-Id: I7caab8e14a9a0b7ccbd38c692b0cf98635967567
Resolves: #15797
Releases: 6.2, 6.1
Reviewed-on: https://review.typo3.org/22840
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn

Revision f4b5aa36 (diff)
Added by Georg Ringer about 6 years ago

[BUGFIX] Use proper implementation of a wordwrap

The page module uses a custom implementation of a wordwrap
as this was not supported by the browser in those earlier days.

The big drawback is that there is no UTF8 support for this which
leads to empty preview boxes when e.g. using Japanese.

The 6.1 version of this patch changes the wordWrapper() usage only
and does not deprecate the method.

Change-Id: I7caab8e14a9a0b7ccbd38c692b0cf98635967567
Resolves: #15797
Releases: 6.2, 6.1
Reviewed-on: https://review.typo3.org/22890
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn

History

#1 Updated by Oliver Hader almost 8 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.

#2 Updated by Georg Ringer about 6 years ago

  • Status changed from Closed to Accepted

example is

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

#3 Updated by Gerrit Code Review about 6 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

#4 Updated by Gerrit Code Review about 6 years ago

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

#5 Updated by Gerrit Code Review about 6 years ago

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

#6 Updated by Gerrit Code Review about 6 years ago

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

#7 Updated by Gerrit Code Review about 6 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

#8 Updated by Georg Ringer about 6 years ago

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

#9 Updated by Benni Mack 12 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF