Re: Re: [Phpgroupware-cvs] [20896] Bug fix : check for already encoded utf8 stuff ...

Benoit Hamet <[email protected]> Wed, 25 Nov 2009 20:27:52 +0100
Newsgroups gmane.comp.web.phpgroupware.devel
Message-ID <[email protected]>
Sigurd Nes a =C3=A9crit :
> Caeies wrote:
>> Revision: 20896
>>         =20
>> http://svn.sv.gnu.org/viewvc/?view=3Drev&root=3Dphpgroupware&revision=3D=
20896
>> Author:   Caeies
>> Date:     2009-11-25 16:35:37 +0000 (Wed, 25 Nov 2009)
>> Log Message:
>> -----------
>> Bug fix : check for already encoded utf8 stuff ... instead of forcing
>> it in all cases since utf8_encode(utf8_encode(X)) !=3D utf_8_encode(X)
>> if X is not pure ascii
>>
>> Modified Paths:
>> --------------
>>     modules/email/trunk/inc/class.mail_msg_base.inc.php
>>
>> Modified: modules/email/trunk/inc/class.mail_msg_base.inc.php
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> --- modules/email/trunk/inc/class.mail_msg_base.inc.php    2009-11-25
>> 16:06:05 UTC (rev 20895)
>> +++ modules/email/trunk/inc/class.mail_msg_base.inc.php    2009-11-25
>> 16:35:37 UTC (rev 20896)
>> @@ -4437,7 +4437,7 @@
>>          */
>>          function ascii2utf($text =3D '')
>>          {  =20
>> -            if ($text =3D=3D utf8_encode($text))
>> +            if ((function_exists('mb_detect_encoding') &&
>> mb_detect_encoding($text) =3D=3D 'UTF-8'))
>>              {
>>                  return $text;
>>              }
>>  =20
> Hi Caeies,
>=20
> That one didn't work (for me).
> the mb_detect_encoding($text) is detecting the text as utf-8 even if it
> is ISO-8859-1
>=20
> Please test.

You too.
if ($text =3D=3D utf8_encode($text)) is a non-sense with already utf8 non
ascii-only text ...

And I didn't put any comment on that in the commit ... But if you want
me to insist on the garbage code on the public list, I will be happy to
do so.

Regards,

Caeies.