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 12 of 12
  1. #1
    Senior Coder
    Join Date
    May 2006
    Posts
    1,673
    Thanks
    28
    Thanked 4 Times in 4 Posts

    Strange characters in my link ??

    Hi,

    I am trying to get rid of non ascii charcters from my links
    because they are not parsing through the .htaccess properly.

    my link is made up of the page name which is in
    Turkish and has the Turkish ü in it.

    When this appears in the link it comes out as %C3%BC
    an this seems to break up.

    I want the charaters to appear in the link name
    but not in the link itself.

    So I tried taking out the % signs with this code:
    PHP Code:
    $mn_link2 str_replace('&','',$mn_link[2]);
    echo 
    "<li><a href='$mn_link2'>$mn_name[2]</a></li>"
    But that didn't work ... I still get the "%C3%BC" in the link.


    How can I filter out these problem characters out of the link ?

    Thanks.



    .
    If you want to attract and keep more clients, then offer great customer support.

    Support-Focus.com. automates the process and gives you a trust seal to place on your website.
    I recommend that you at least take the 30 day free trial.

  • #2
    New Coder
    Join Date
    Nov 2013
    Posts
    20
    Thanks
    0
    Thanked 2 Times in 2 Posts
    try explode('%C3%BC', $variable); or explode('ü', $variable);

  • #3
    Senior Coder
    Join Date
    May 2006
    Posts
    1,673
    Thanks
    28
    Thanked 4 Times in 4 Posts
    Hi,

    I can not see how the explode() would help


    .
    If you want to attract and keep more clients, then offer great customer support.

    Support-Focus.com. automates the process and gives you a trust seal to place on your website.
    I recommend that you at least take the 30 day free trial.

  • #4
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,091
    Thanks
    51
    Thanked 506 Times in 493 Posts
    Quote Originally Posted by jeddi View Post
    So I tried taking out the % signs with this code:
    PHP Code:
    $mn_link2 str_replace('&','',$mn_link[2]);
    echo 
    "<li><a href='$mn_link2'>$mn_name[2]</a></li>"
    No, you tried replacing the & symbol

    Quote Originally Posted by jeddi View Post
    But that didn't work ... I still get the "%C3%BC" in the link.

    How can I filter out these problem characters out of the link ?
    You can't. It's converted by the browser. In theory the webserver should detect and convert these back into something usable but I've no idea how this works with foreign languages such as turkish.

    Quote Originally Posted by PluginDropout View Post
    try explode('%C3%BC', $variable); or explode('ü', $variable);
    That wold output an array of everything either side of each u character. Although it would in essence remove the character, it's a very long winded way of doing it.

    Quote Originally Posted by jeddi View Post
    Hi,
    I can not see how the explode() would help
    Well it would remove the character (though if you use it in your str_replace call instead of & that will do it too) and you could then inplode the resulting array back together with another character instead. The problem is you'd need to find one that doesn't also end up making the browser convert it.
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  • #5
    New Coder
    Join Date
    Nov 2013
    Posts
    20
    Thanks
    0
    Thanked 2 Times in 2 Posts
    I'm doing this off the top of my head and as a suggestion.

    I have no idea how his code works since he hasn't posted it up only a snip.

    Code:
      $url = "http://pagename.com/show%C3%BCmelink";
        $urlarray = explode('%C3%BC', $url);
          $masharray = $urlarray[0]+$urlarray[1];
            $result_url = implode("", $masharray);
    
              $fp = fopen('/home/whatever/page_html/parsing.txt', 'a'); 
    
                fwrite($fp, "\n");
                fwrite($fp, $result_url);            
                fclose($fp);

  • #6
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,091
    Thanks
    51
    Thanked 506 Times in 493 Posts
    What are you doing writing that to a file?
    The op is trying to write the link in the outputted html and suddenly not only are you trying to explode it all you're then trying to put it into a seperate file?

    You're not thinking clearly on this.
    Last edited by tangoforce; 11-05-2013 at 11:48 AM.
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  • #7
    Senior Coder
    Join Date
    May 2006
    Posts
    1,673
    Thanks
    28
    Thanked 4 Times in 4 Posts
    Hi ,

    Maybe I was not not clear.

    I have a link like this:

    http://uzman-bilgisayar.simpg.net/Gü...mleri-p42.html

    Because of the u with dots ... it comes out like this:

    http://uzman-bilgisayar.simpg.net/G%...mleri-p42.html


    This should get directed to page 42 of the website by my .htaccess
    but it doesn't.

    I have tried to remove the "%" with :

    PHP Code:
    $mn_link2 str_replace('%','',$mn_link[2]); 
    echo 
    "<li><a href='$mn_link2'>$mn_name[2]</a></li>"
    (fixed it from last time )

    But still I can not get a clean link

    Anyone know why ?

    PS
    I tried the same code to take out 'e' from same link

    i.e.

    PHP Code:
    $mn_link2 str_replace('e','',$mn_link[2]); 
    echo 
    "<li><a href='$mn_link2'>$mn_name[2]</a></li>"
    And that works.

    I tried to take out u with dots : ü

    PHP Code:
    $mn_link2 str_replace('ü','',$mn_link[2]); 
    echo 
    "<li><a href='$mn_link2'>$mn_name[2]</a></li>"
    But that didn't work


    I also tried:
    PHP Code:
    $mn_link2 str_replace('%C3%BC','',$mn_link[2]); 
    echo 
    "<li><a href='$mn_link2'>$mn_name[2]</a></li>"

    But again ... that didn't work



    .
    Last edited by jeddi; 11-05-2013 at 01:12 PM.
    If you want to attract and keep more clients, then offer great customer support.

    Support-Focus.com. automates the process and gives you a trust seal to place on your website.
    I recommend that you at least take the 30 day free trial.

  • #8
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,899
    Thanks
    15
    Thanked 226 Times in 226 Posts
    It's pretty obvious that the characters are being escaped at some point. You could try simply un-escaping them or encoding them in another format then un-encoding them. Also, don't put the double dot U in the link or URL, put its' utf-8 equivalent.
    Welcome to http://www.myphotowizard.net

    where you can edit images, make a photo calendar, add text to images, and do much more.


    When you know what you're doing it's called Engineering, when you don't know, it's called Research and Development. And you can always charge more for Research and Development.

  • #9
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,091
    Thanks
    51
    Thanked 506 Times in 493 Posts
    Quote Originally Posted by DrDOS View Post
    It's pretty obvious that the characters are being escaped at some point.
    No they are not. The browser is URL encoding them.

    When using a browser such as seamonkey this does not happen. Seamonkey does not pre url encode links. It does it transparently so the user does not notice.

    Look at this:



    As you can see when I point to the second link (and the first) the url in the statusbar shows it as it should be from the html. IE will not do this, it will show the url encoded version.
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  • #10
    Senior Coder
    Join Date
    May 2006
    Posts
    1,673
    Thanks
    28
    Thanked 4 Times in 4 Posts
    So ... please ...

    how do I solve this

    -- As I wrote, I have tried "don't put the double dot U in the link" by trying
    to replace it. But I can not seem to do that


    Thanks.


    .
    If you want to attract and keep more clients, then offer great customer support.

    Support-Focus.com. automates the process and gives you a trust seal to place on your website.
    I recommend that you at least take the 30 day free trial.

  • #11
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,091
    Thanks
    51
    Thanked 506 Times in 493 Posts
    I have no idea. All you can do (imo) is to let the browser continue to convert it into a url encoded address. I've no idea how else to work around this other than to use a normal u letter.
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  • #12
    Senior Coder
    Join Date
    May 2006
    Posts
    1,673
    Thanks
    28
    Thanked 4 Times in 4 Posts
    That's OK.

    Thanks anyway.

    What I have done is used (.*?) in the redirect so that
    accepts any characters.



    .
    If you want to attract and keep more clients, then offer great customer support.

    Support-Focus.com. automates the process and gives you a trust seal to place on your website.
    I recommend that you at least take the 30 day free trial.


  •  

    Posting Permissions

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