Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42413 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60164 invoked from network); 30 Dec 2008 16:24:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Dec 2008 16:24:20 -0000 Authentication-Results: pb1.pair.com smtp.mail=typoon@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=typoon@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.21 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: typoon@gmail.com X-Host-Fingerprint: 209.85.218.21 mail-bw0-f21.google.com Received: from [209.85.218.21] ([209.85.218.21:46178] helo=mail-bw0-f21.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3E/34-29733-23B4A594 for ; Tue, 30 Dec 2008 11:24:19 -0500 Received: by bwz14 with SMTP id 14so13502527bwz.23 for ; Tue, 30 Dec 2008 08:24:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=q4+DlixYtlkyyPe0ewuM1sCj2OxrF602JUDz+ou+/ck=; b=Mw2ptrmtTBE5vU4P7X43k/vE4LZOOrrjurB86IWyBDMtQpQP84SxNdK5MFNGByU778 sa0fBeK4CuAyT0YtpjDB6jMGDbydQgDoCAw+iZYnDTb9TH6KOJULLd+KC3ab1lYcr18I JH9EuFbIh0+LLnYfhuH/9wFCRDN7v5Rf5wclU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=eoGZfPT4phbH54O01NoxXbpbXu0ADGiEaXOHL9UVfKiiB+B5HF7gmk0lMLJXb+Btyx NjGrf+TTsYDMkXZGnQToTQJy/E5Hb71UsXCviBO1uSXEaogsefhRsYCVio4Q7brg9eGB f6hAmG4QXbjl5CVymlfxwOyOd/NOB9nAtZeqU= Received: by 10.102.218.5 with SMTP id q5mr5336170mug.99.1230654255501; Tue, 30 Dec 2008 08:24:15 -0800 (PST) Received: by 10.103.250.13 with HTTP; Tue, 30 Dec 2008 08:24:15 -0800 (PST) Message-ID: Date: Tue, 30 Dec 2008 10:24:15 -0600 To: internals@lists.php.net MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_143757_8501708.1230654255471" Subject: [PATCH] Bug #46806 - mb_strimwidth From: typoon@gmail.com ("Henrique M. Decaria") ------=_Part_143757_8501708.1230654255471 Content-Type: multipart/alternative; boundary="----=_Part_143758_20445695.1230654255471" ------=_Part_143758_20445695.1230654255471 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello guys, Looking in the subject mentioned bug report, it seems that the attached patch might do the trick and make the mb_strimwidth() function work as explained in the php manual (http://br2.php.net/mb_strimwidth). According to it, the function should trim up to the defined width and append the trimmarker, that being said, the following code should return "hello..." not "he..." echo mb_strimwidth('helloworld', 0, 5, '...', 'UTF-8'); The change in the file is: - pc.width = width - mkwidth; + pc.width = width; I am not sure why there is this "- mkwidth" there, but it seems to be used to remove the last "mkwidth" characters from the trimmed string so it would be replaced with the trimmarker. It could be that the test file for this function is incorrect (i can't guarantee as I am having issues with Japanese characters here). So please, if you could have a look and see if it works as expected with this patch it would be great. Thanks, Henrique ------=_Part_143758_20445695.1230654255471 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello guys,

Looking in the subject mentioned bug report, it seems that the attached patch might do the trick and make the mb_strimwidth() function work as explained in the php manual (http://br2.php.net/mb_strimwidth).
According to it, the function should trim up to the defined width and append the trimmarker, that being said, the following code should return "hello..." not "he..."

echo mb_strimwidth('helloworld', 0, 5, '...', 'UTF-8');

The change in the file is:

-    pc.width = width - mkwidth;
+    pc.width = width;

I am not sure why there is this "- mkwidth" there, but it seems to be used to remove the last "mkwidth" characters from the trimmed string so it would be replaced with the trimmarker.

It could be that the test file for this function is incorrect (i can't guarantee as I am having issues with Japanese characters here). So please, if you could have a look and see if it works as expected with this patch it would be great.

Thanks,

Henrique
------=_Part_143758_20445695.1230654255471-- ------=_Part_143757_8501708.1230654255471 Content-Type: text/plain; name=mbfilter.txt Content-Transfer-Encoding: base64 X-Attachment-Id: f_fpcrn0dw0 Content-Disposition: attachment; filename=mbfilter.txt SW5kZXg6IGV4dC9tYnN0cmluZy9saWJtYmZsL21iZmwvbWJmaWx0ZXIuYwo9PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ClJD UyBmaWxlOiAvcmVwb3NpdG9yeS9waHAtc3JjL2V4dC9tYnN0cmluZy9saWJtYmZsL21iZmwvbWJm aWx0ZXIuYyx2CnJldHJpZXZpbmcgcmV2aXNpb24gMS43LjIuNS4yLjEuMi4xCmRpZmYgLXUgLXIx LjcuMi41LjIuMS4yLjEgbWJmaWx0ZXIuYwotLS0gZXh0L21ic3RyaW5nL2xpYm1iZmwvbWJmbC9t YmZpbHRlci5jCTEgQXVnIDIwMDggMjI6NTY6NDcgLTAwMDAJMS43LjIuNS4yLjEuMi4xCisrKyBl eHQvbWJzdHJpbmcvbGlibWJmbC9tYmZsL21iZmlsdGVyLmMJMzAgRGVjIDIwMDggMTY6MTI6MzIg LTAwMDAKQEAgLTE1NTgsNyArMTU1OCw3IEBACiAJCW1rd2lkdGggPSBtYmZsX3N0cndpZHRoKG1h cmtlcik7CiAJfQogCXBjLmZyb20gPSBmcm9tOwotCXBjLndpZHRoID0gd2lkdGggLSBta3dpZHRo OworCXBjLndpZHRoID0gd2lkdGg7CiAJcGMub3V0d2lkdGggPSAwOwogCXBjLm91dGNoYXIgPSAw OwogCXBjLnN0YXR1cyA9IDA7Cg== ------=_Part_143757_8501708.1230654255471--