Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42473 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30879 invoked from network); 4 Jan 2009 16:35:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jan 2009 16:35:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=mozo@mozo.jp; spf=permerror; sender-id=permerror Authentication-Results: pb1.pair.com header.from=mozo@mozo.jp; sender-id=permerror Received-SPF: error (pb1.pair.com: domain mozo.jp from 209.85.142.189 cause and error) X-PHP-List-Original-Sender: mozo@mozo.jp X-Host-Fingerprint: 209.85.142.189 ti-out-0910.google.com Received: from [209.85.142.189] ([209.85.142.189:59177] helo=ti-out-0910.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8E/C8-07052-345E0694 for ; Sun, 04 Jan 2009 11:35:22 -0500 Received: by ti-out-0910.google.com with SMTP id u3so5250056tia.17 for ; Sun, 04 Jan 2009 08:35:10 -0800 (PST) Received: by 10.110.61.16 with SMTP id j16mr4985449tia.24.1231086910531; Sun, 04 Jan 2009 08:35:10 -0800 (PST) Received: from ?192.168.0.128? (i58-89-25-149.s04.a014.ap.plala.or.jp [58.89.25.149]) by mx.google.com with ESMTPS id a14sm18984357tia.12.2009.01.04.08.35.08 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 04 Jan 2009 08:35:09 -0800 (PST) Message-ID: <495F9578.6090609@mozo.jp> Date: Sun, 04 Jan 2009 01:42:32 +0900 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.1b3pre) Gecko/20081204 Thunderbird/3.0b1 MIME-Version: 1.0 To: "Henrique M. Decaria" CC: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [PATCH] Bug #46806 - mb_strimwidth From: mozo@mozo.jp (Moriyoshi Koizumi) Hi, This behavior seems strange, but the rationale of this function is that the (east asian) width of the resulting string does not exceed the specified value so that it would fit to a fixed sized box when rendered in the browser, assuming the string would be displayed with a monospace font. So, it is the document that is wrong. Regards, Moriyoshi (2008/12/31 1:24), Henrique M. Decaria wrote: > 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 > > -- -- moriyoshi