Tags:
create new tag
, view all tags
URL's with spaces don't render correctly

eg http://test/a%20test%20with%20spaces.html

this is just the tip of the iceberg... but it is the bit that i have fixed...

from http://www.ietf.org/rfc/rfc2396.txt you can see that there are actually more escape sequences possible

My Solution

sub externalLink
{
    my( $pre, $url ) = @_;
    my ( $renderedUrl ) = $url;
    $renderedUrl =~ s/%20/ /g;
    if( $url =~ /\.(gif|jpg|jpeg)$/ ) {
        my $filename = $renderedUrl;
        $filename =~ s@.*/([^/]*)@$1@go;
        return "$pre<IMG src=\"$url\" alt=\"$filename\">";
    }

    return "$pre<A href=\"$url\" target=\"_top\">$renderedUrl</A>";
}

.......snip.....
# Handle embedded URLs
     s@(^|[\-\*\s])((http|ftp|gopher|news|https|file)\:(\S+[^\s\.,!\?;:]))@&externalLink($1,$2)@geo;

-- SvenDowideit - 29 Dec 2000

First I wanted to put it into the core but then decided not to do that because users may want to print out the URL and copy the URL into the clipboard. If you change the escaped chars to literal chars you will lose that capability.

-- PeterThoeny - 26 Nov 2001

On the other hand the user could just click on the link and copy from the navigation input. I'ld prefer correctly rendered pages since anybody sees them while not anybody will want to copy them directly. Just my preference wink

-- MichaelUtech

I've decided to re-open this as I think I disagree with Peter.. smile in this specific case (spaces as % 20) there should be no problem with the user cutting and pasting the rendered URL. I'm not sure about the other special characters, but I think that the browser takes care of them too.

-- SvenDowideit - 28 Nov 2002

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2002-11-28 - SvenDowideit
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.