mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG Tweak DBHTMLText::Plain to avoid treating some chinese characters as line breaks.
This commit is contained in:
parent
8eab6c6549
commit
b780c4f504
@ -228,7 +228,7 @@ class DBHTMLText extends DBText
|
|||||||
$text = strip_tags($text);
|
$text = strip_tags($text);
|
||||||
|
|
||||||
// Implode >3 consecutive linebreaks into 2
|
// Implode >3 consecutive linebreaks into 2
|
||||||
$text = preg_replace('~(\R){2,}~', "\n\n", $text);
|
$text = preg_replace('~(\R){2,}~u', "\n\n", $text);
|
||||||
|
|
||||||
// Decode HTML entities back to plain text
|
// Decode HTML entities back to plain text
|
||||||
return trim(Convert::xml2raw($text));
|
return trim(Convert::xml2raw($text));
|
||||||
|
@ -265,6 +265,10 @@ class DBHTMLTextTest extends SapphireTest
|
|||||||
[
|
[
|
||||||
'<p>Collapses</p><p></p><p>Excessive<br/><br /><br>Newlines</p>',
|
'<p>Collapses</p><p></p><p>Excessive<br/><br /><br>Newlines</p>',
|
||||||
"Collapses\n\nExcessive\n\nNewlines",
|
"Collapses\n\nExcessive\n\nNewlines",
|
||||||
|
],
|
||||||
|
'Unicode character that could be confused for a line break' =>[
|
||||||
|
'充美好实的一天',
|
||||||
|
'充美好实的一天'
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user