UTF-8 compatible Lettercut
-
I am a Chinese user. Lots of my posts are UTF-8 characters.
In your “lettercut” functions, “substr()” function ignores UTF-8 characters, resulting in incorrect question mark in the end.
By checking the solution on Stackoverflow (https://stackoverflow.com/questions/12446877/php-is-it-possible-to-correctly-substr-a-utf-8-string), I suggest that using mb_substr() instead.
—> the following code is suggested
// Limit the post by letter to check for more tag $new_string2 = mb_substr($content2, 0, $alpr_post_letters+3, 'UTF-8'); $end_string2 = mb_substr($new_string2, -5, 'UTF-8'); $endingp = ""; // Limit the post by letter $new_string = mb_substr($content, 0, $alpr_post_letters+3, 'UTF-8'); $end_string = mb_substr($new_string, -5, 'UTF-8'); $endingp = ""; // If end of p-tag is missing create one if ($end_string == "</p>\n") { $new_string = mb_substr($new_string, 0, (strlen($new_string)-5), 'UTF-8'); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘UTF-8 compatible Lettercut’ is closed to new replies.