|
Posted by Andy Hassall on 05/27/05 23:26
On 27 May 2005 13:08:32 -0700, lkrubner@geocities.com wrote:
>When I discovered this page:
>
>http://us2.php.net/recode_string
>
>I thought this function might solve my problems.
Which problem?
>This page says recode_string understands the UTF-8 charset:
>
>http://www.delorie.com/gnu/docs/recode/recode_30.html
>
>I came up with a little test, you can see the code below, and I put it
>up on my server:
>
>http://www.publicdomainsoftware.org/testRecode.php
>
>Sadly, my server doesn't seem to have the function recode_string
>built-in with PHP. We are leasing a server from Rackspace. I could ask
>them to rebuild PHP with that function in it, at a cost of like $120,
>but I'd like to know if it would work first.
>
>I wanted to write some very strange characters in a Microsoft Word
>document, using every rare and bizzare character I could find, then I'd
>copy and paste that to the textarea in the form below, and then I'd see
>if it could be output without garbage characters as UTF-8.
Remember the Joel article you posted? It's all down to the key sentence in
there; if you don't know the original encoding of your data you are stuffed.
>But, sadly, I can't run the test on my server. So does anyone know if
>this would work?
>
> if (function_exists("recode_string")) {
> $result = recode_string("UTF-8", $textToTest);
recode_string converts from one encoding to another.
You've specified just one encoding. What's it supposed to do? From a brief
read of the manual it seems to default to Latin-1 a.k.a ISO-8859-1 if you don't
specify one of the encodings.
If it's not in ISO-8859-1 in the first place, the results won't be "correct".
This function doesn't seem any different, as far as I can see, to
http://uk.php.net/manual/en/function.mb-convert-encoding.php except it's more
obscure.
--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Navigation:
[Reply to this message]
|