Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Jul 2009
    Posts
    45
    Thanks
    23
    Thanked 0 Times in 0 Posts

    Convert chars in url (%E0%EB%E5%) to cyrillic

    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&so...007&bih=576&q=%E0%EB%E5&aq=f&aqi=g10&aql=&oq=&gs_rfai=

  • #2
    Regular Coder poyzn's Avatar
    Join Date
    Nov 2010
    Posts
    266
    Thanks
    2
    Thanked 61 Times in 61 Posts
    try this with the string
    PHP Code:
    echo urldecode('%E0%EB%E5'); 
    or with the whole url
    PHP Code:
    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='); 

  • Users who have thanked poyzn for this post:

    alexpk (12-19-2010)

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • Users who have thanked Fou-Lu for this post:

    alexpk (12-19-2010)

  • #4
    New Coder
    Join Date
    Jul 2009
    Posts
    45
    Thanks
    23
    Thanked 0 Times in 0 Posts
    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)

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • Users who have thanked Fou-Lu for this post:

    alexpk (12-19-2010)

  • #6
    Regular Coder poyzn's Avatar
    Join Date
    Nov 2010
    Posts
    266
    Thanks
    2
    Thanked 61 Times in 61 Posts
    Quote Originally Posted by Fou-Lu View Post
    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.
    Last edited by poyzn; 12-18-2010 at 08:25 PM.

  • Users who have thanked poyzn for this post:

    alexpk (12-19-2010)

  • #7
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • Users who have thanked Fou-Lu for this post:

    alexpk (12-19-2010)

  • #8
    New Coder
    Join Date
    Jul 2009
    Posts
    45
    Thanks
    23
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •