Re: utf-8-safe replacement for strtr()?
| From: | Nisse Engström | Date: | Thu, 26 Mar 2009 15:36:11 +0000 |
| Subject: | Re: utf-8-safe replacement for strtr()? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-290704@lists.php.net to get a copy of this message | ||
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...
/Nisse