On 3/26/09 11:36 AM, "Nisse Engström" <news.nospam.0ixbt...@luden.se> wrote:
> On Wed, 25 Mar 2009 11:32:42 +0100, Nisse Engström wrote:
>> On Tue, 24 Mar 2009 08:15:35 -0400, Tom Worster wrote:
>>> 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.
> Oops. I meant to write that one complete character does
> not match any part of any other character. If a string
> of one or more utf-8 characters match a utf-8 text, it
> matches exactly those characters in the text. If that
> makes sense...
my conclusion is that 2-param strtr is safe if the subject text and
parameter strings are valid utf-8.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php