iconv - bad encoding

View: New views
3 Messages — Rating Filter:   Alert me  

iconv - bad encoding

by Jarosek J. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello

I noticed a problem using iconv, but investigation showed, that this is
not exectly the iconv itself, but something like php encoding.

 From the beginning:

a hava an incoming variable $text;
it has some Polish diactics 'strona główna'.
I expect to remove diactics : 'strona glowna'.

So I use iconv: iconv('utf-8', 'us-ascii//TRANSLIT', $text)

and unfortunetly i get: 'strona g??wna' ... But only under apache, in
browser

The same file, command, etc run from bash gives: 'strona glowna' ... OK
So i think : "bad config", but double checked and configs are
identical... (cli and apache2)

Best part: for 2 or 3 times after starting computer (debian), it didn't
worker until I did: (apache start && apache stop - not apache restart),
then it worked. Now it doesn't work any more. No other config (except
php was changed).

Any ideas?




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


Re: iconv - bad encoding

by Moriyoshi Koizumi-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Are you sure that $text was really encoded in UTF-8 when the output
was garbled? try dumping bin2hex($text) to see if there's any
difference.

Regards,
Moriyoshi

2009/10/2 Jarosek <jarosek1@...>:

> Hello
>
> I noticed a problem using iconv, but investigation showed, that this is
> not exectly the iconv itself, but something like php encoding.
>
> From the beginning:
>
> a hava an incoming variable $text;
> it has some Polish diactics 'strona główna'.
> I expect to remove diactics : 'strona glowna'.
>
> So I use iconv: iconv('utf-8', 'us-ascii//TRANSLIT', $text)
>
> and unfortunetly i get: 'strona g??wna' ... But only under apache, in
> browser
>
> The same file, command, etc run from bash gives: 'strona glowna' ... OK
> So i think : "bad config", but double checked and configs are
> identical... (cli and apache2)
>
> Best part: for 2 or 3 times after starting computer (debian), it didn't
> worker until I did: (apache start && apache stop - not apache restart),
> then it worked. Now it doesn't work any more. No other config (except
> php was changed).
>
> Any ideas?
>
>
>
>
> --
> PHP Unicode & I18N Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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


Re: iconv - bad encoding

by Jarosek J. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/10/5 Moriyoshi Koizumi <mozo@...>

> Are you sure that $text was really encoded in UTF-8 when the output
> was garbled? try dumping bin2hex($text) to see if there's any
> difference.
>
> Regards,
> Moriyoshi
>
> 2009/10/2 Jarosek <jarosek1@...>:
> > Hello
> >
> > I noticed a problem using iconv, but investigation showed, that this is
> > not exectly the iconv itself, but something like php encoding.
> >
> > From the beginning:
> >
> > a hava an incoming variable $text;
> > it has some Polish diactics 'strona główna'.
> > I expect to remove diactics : 'strona glowna'.
> >
> > So I use iconv: iconv('utf-8', 'us-ascii//TRANSLIT', $text)
> >
> > and unfortunetly i get: 'strona g??wna' ... But only under apache, in
> > browser
> >
> > The same file, command, etc run from bash gives: 'strona glowna' ... OK
> > So i think : "bad config", but double checked and configs are
> > identical... (cli and apache2)
> >
> > Best part: for 2 or 3 times after starting computer (debian), it didn't
> > worker until I did: (apache start && apache stop - not apache restart),
> > then it worked. Now it doesn't work any more. No other config (except
> > php was changed).
> >
> > Any ideas?
> >
> >
> >
> >
> > --
> > PHP Unicode & I18N Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>

Thank's for the replay. I needed to set locale to pl_PL.UTF-8 . Strange
think is that it worked without it under the cli... with the same
configuration. Well... it works now.

Best regards
JJ