Thanks,
But how can I understand when to decode string and when not ?

Rosen



"Seairth Jacobs" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> "Rosen" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > HI,
> > I'm using "urldecode" function to decode string from
> > "getenv("QUERY_STRING");", but part of
> > it is in cyrrilic (windows-1251) charset.
> >
> > I have following code:
> >
> >
>
$a="%D1%81%D1%87%D0%B5%D1%82%D0%BE%D0%B2%D0%BE%D0%B4%D0%BD%D0%B0+%D0%BA%D1%8
> > A%D1%89%D0%B0";
> > $b="%d1%ee%f4%f2%f3%e5%f0";
> >
> > echo "a=" . urldecode($a);
> > echo "<br>b=" . urldecode($b);
> >
> > On the second string it works correctly, but on first it don't.
> > These two vars are getted from two different pages ( as refferers ).
> > I think the problem could be in encoding used in two pages.
>
> When I run the code without setting a charset (defaulting to UTF-8), I get
> back the following:
>
> a=?????????? ????
> b=????ody>
>
> When I run the code setting the charset to windows-1251, I get:
>
> a=???‡?µ?‚???????????° ?????‰?°
> b=???????
>
>
> I'm guessing you want "a" from the first one and "b" from the second one.
> In which case, you are correct.  Two different character encodings are
being
> URL encoded.  You could convert the first string using:
>
> convert_cyr_string(mb_convert_encoding(urldecode($a), 'ISO-8859-5',
> 'UTF-8'), 'i', 'w')
>
>
> --
> ---
> Seairth Jacobs
> [EMAIL PROTECTED]
>
>
>



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

Reply via email to