...

View Full Version : Convert chars in url (%E0%EB%E5%) to cyrillic



alexpk
12-18-2010, 04:28 PM
Hello how can I convert from url a %E0%EB%E5% to display in cyrillic: але

Sample with Google

http://www.google.bg/search?hl=bg&source=hp&biw=1007&bih=576&q=%E0%EB%E5&aq=f&aqi=g10&aql=&oq=&gs_rfai=

poyzn
12-18-2010, 05:20 PM
try this with the string


echo urldecode('%E0%EB%E5');

or with the whole url


echo urldecode('http://www.google.bg/search?hl=bg&source=hp&biw=1007&bih=576&q=%E0%EB%E5&aq=f&aqi=g10&aql=&oq=&gs_rfai=');

Fou-Lu
12-18-2010, 05:41 PM
On a side note, if this is coming from your own querystring, you should not need to urldecode your own get/request data. The same applies for a form as well so long as it was not entered in encoded data.
Beyond this, you may need to send the proper content-type headers to change the charset in use.

alexpk
12-18-2010, 06:14 PM
Actually I want to control the text via url, not via form.I know that if I use it with form, it works.

The urldecode doesn't work.

When I use the form I get - %D0%B0%D0%BB%D0%B5 and that works, but when I just type in the url I get %E0%EB%E5 and that is wrong. (this is one some text)

Fou-Lu
12-18-2010, 07:24 PM
By URL you mean your URL correct? Not evaluating an external one?
According to the API, both REQUEST and GET are automatically decoded when interpreting the querystring. It also indicates manually decoding the already decoded data is dangerous: http://php.ca/manual/en/function.urldecode.php

When you are creating the querystring to pass, you must encode this yourself.

When you type in the actual %XX strings into a urldecode, which one provides the proper results the first or the second? I would assume the first which would indicate that the actual typing into the url is your bottleneck, and not the processing itself (perhaps the browser isn't interpreting the characterset properly).

I can't view either of these ones and I'm not installing new language sets just to check. PHP has always been a pain with multibyte charsets too, hopefully the native utf8 in PHP6 will help this.

poyzn
12-18-2010, 09:21 PM
I can't view either of these ones and I'm not installing new language sets just to check. PHP has always been a pain with multibyte charsets too, hopefully the native utf8 in PHP6 will help this.

There is no problem with utf8 in php5. It works fine even in ajax.

Fou-Lu
12-18-2010, 11:45 PM
I didn't say it was a problem, I said it was a pain. PHP is not native to multibyte charsets; that feature will (supposedly) be added in PHP6.
To use multibyte you'll need to ensure that mb_string has been loaded within PHP, and to chain it to standard string manipulation functions (such as substr and strlen for examples), the ini must be set to include the mbstring.func_overload to override the original functions. This ONLY applies to string manipulations, input variable handling should not be impacted if only in and out are performed without any additional work. It is highly probable that PHP will not detect the charset though, so you will likely need to send a content-type header in order to pump the correct character sets.

alexpk
12-19-2010, 10:55 AM
I collected all the characters after moving them from form and then used them with preg_replace to make them work.Thanks for the replies.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum