Skip to content

Commit

Permalink
Improve Helper::strSplitKeepWords() function with Chinese symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
freescout-help-desk committed Dec 7, 2024
1 parent 01bfd5c commit 51dbe56
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/Misc/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,19 @@ public static function queueWorkerRestart()
*/
public static function strSplitKeepWords($str, $max_length = 75)
{
$array_words = explode(' ', $str);
$space = html_entity_decode(' ');

$str = strtr($str, [
'' => ''.$space,
'' => ''.$space,
// '.' => '.'.$space,
// ',' => ','.$space,
//':' => ':'.$space,
// '—' => '—'.$space,
// '।' => '।'.$space,
]);

$array_words = explode($space, $str);

$currentLength = 0;

Expand Down

0 comments on commit 51dbe56

Please sign in to comment.