Home > Archive > PHP Language > February 2005 > strtr & unicode
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Nick Valeous 2005-02-20, 3:55 pm |
| I have a unicode string "ÜÝee" and I want to replace some letters with some
other letters:
When i use strtr, it messes up the string:
eg
$s = "ÜÝee";
echo $s; // will output ÜÝee
echo strtr($sTerm, "Ü", "|"); // will output |?|?ee
If you can't read the characters above, here is another example where 1234
are unicode characters (utf-8):
$s = "1234";
echo $s; // will output 1234
echo strtr($sTerm, "1", "|"); // will output |?|?34
any work arround? :-/
| |
|
|
| Oli Filth 2005-02-20, 3:55 pm |
| Nick Valeous wrote:
> I have a unicode string "ÜÝee" and I want to replace some letters with some
> other letters:
>
> When i use strtr, it messes up the string:
>
> eg
>
> $s = "ÜÝee";
> echo $s; // will output ÜÝee
> echo strtr($sTerm, "Ü", "|"); // will output |?|?ee
>
>
> If you can't read the characters above, here is another example where 1234
> are unicode characters (utf-8):
>
> $s = "1234";
> echo $s; // will output 1234
> echo strtr($sTerm, "1", "|"); // will output |?|?34
>
> any work arround? :-/
See http://uk.php.net/manual/en/ref.mbstring.php for multibyte string
functions.
--
Oli
|
|
|
|
|