Bug #75153 [Opn->Nab]: wrap words are getting utf8 error

From: Date: Mon, 04 Sep 2017 15:57:08 +0000
Subject: Bug #75153 [Opn->Nab]: wrap words are getting utf8 error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210933@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75153&edit=1 ID: 75153 Updated by: requinix@php.net Reported by: patrykmoura at gmail dot com Summary: wrap words are getting utf8 error -Status: Open +Status: Not a bug Type: Bug Package: Strings related Operating System: Unix and Windows PHP Version: 7.0.23 Block user comment: N Private report: N New Comment: As with many string functions wordwrap() is not multibyte safe. Unfortunately the mbstring extension does not have an equivalent, but the user comments in the docs for wordwrap suggest a couple PCRE-based solutions for UTF-8 encoding. Previous Comments: ------------------------------------------------------------------------ [2017-09-04 14:35:09] patrykmoura at gmail dot com Description: ------------ Hello, When I do a wordwrap, or a preg_replace with a regex, or a implode with limit 10 with the word "Higienização", it returns "Higieniza??ão" instead of "Higienizaç ão". I guess there's something about the Ç word. Thanks Test script: --------------- echo wordwrap("Higienização", 10, " ", true); echo implode(PHP_EOL, str_split("Higienização", 10)); echo preg_replace('/([^\s]{10})(?=[^\s])/', '$1'.' ', $string); Expected result: ---------------- "Higienizaç ão" Actual result: -------------- "Higieniza??ão" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75153&edit=1

« previous php.bugs (#210933) next »