Re: utf-8-safe replacement for strtr()?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



thanks for the info.

i'll leave 2-param uses of strtr in my code alone. i have a replacement for
the 3-param version.

btw: i have quite a long checklist of stuff to do when upgrading code for
utf-8, including notes on about 100 functions. do you think it would be
worth putting it on a wiki somewhere?


On 3/25/09 6:32 AM, "Nisse Engström" <news.NOSPAM.0ixbtqKe@xxxxxxxx> wrote:

> On Tue, 24 Mar 2009 08:15:35 -0400, Tom Worster wrote:
> 
>> On 3/23/09 2:02 PM, "Tom Worster" <fsb@xxxxxxxxxx> wrote:
>> 
>>> i havea general replacement or workaround for every php function in my code
>>> that i know to be utf-8-unsafe. except one: strtr().
>> 
>> strtr() with three parameters is certainly unsafe. but my tests are showing
>> that it may be ok with two parameters if the strings in the second parameter
>> are well formed utf-8.
>> 
>> does anyone know more? can confirm or contradict?
> 
> The two-argument version of strtr() should work fine
> since there are no collisions in utf-8 such that part
> of one character matches part of a different character.
> 
> The question is whether the function is binary safe.
> The manual page doesn't say as far as I can tell.
> Google came up with the following:
> 
> strtr() made binary safe in PHP3:
>   <http://marc.info/?l=php-general&m=92740681805351&w=4>
> 
> Two-argument version added in PHP4:
>   <http://php.net/ChangeLog-4.php>
> 
> 
> /Nisse



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux