Links ending with a ) - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4) +---- Forum: Scripting (/forumdisplay.php?fid=39) +----- Thread: Links ending with a ) (/showthread.php?tid=95088) Links ending with a ) by macgyver08 on 07-23-2010 at 08:57 AM
Does anyone know why links that end with a ) turn out like the following when sent through an IM to someone?: RE: Links ending with a ) by CookieRevised on 07-23-2010 at 10:14 AM
instead of using ( or ) literally, you should encode them... This because ( and ) are actually reserved characters. RE: Links ending with a ) by macgyver08 on 07-23-2010 at 11:40 AM Hmm...it's not very aesthetically pleasing with the percentages in the URL. Is that the only way you know of? RE: Links ending with a ) by Chris4 on 07-23-2010 at 02:53 PM
A short URL: RE: Links ending with a ) by matty on 07-24-2010 at 06:49 PM
quote:Cookie fail... both parenthesis do not have the same value. It is: ( => %28 ) => %29 RE: Links ending with a ) by CookieRevised on 07-25-2010 at 01:41 PM
quote:blah.... copy/paste booboo.... fixed quote:Yes.... because those characters shouldn't be used literally in URLs because they are reserved characters. Making URLs should be done according to some set standards. Another way would be to use some URL forwarding like Chris4 showed, but those are URLs too and have the exact same rules and need to follow the exact same standards. This is also explained on http://en.wikipedia.org/wiki/Percent-encoding RE: Links ending with a ) by Eljay on 07-25-2010 at 02:29 PM
The "escape" method shouldn't be used for this though: quote: Unfortunately, using encodeURI doesn't encode parentheses (it appears JScript 5.6 is older than the latest RFC about URIs ) so it doesn't really help. Although even if they are reserved characters now, Messenger should still match them as part of the URI, so it's a bug. RE: Links ending with a ) by CookieRevised on 07-25-2010 at 05:33 PM
quote:Hence why I suggest to use escape() instead (in this situation). The reason why they suggest not to use escape() has to do with how it handles other characters (eg: it encodes some characters which don't need to be encoded) and that it, therefor, can't be used on a complete link (eg: it also encodes ":" in the "http://" part, and the ampersand & and equal sign = in a query string). But this is better than not encoding certain characters which should best be encoded (like the parenthesis). In short, for 'simple' links, in ascii format, without any query components or anchors, the escape() method is a proper (and safer) method to use though as long as you don't include the "http://" part. Ori: http://www.this.com/that.html (spaced)?data1=1&data2=1#anchor4 escape() => http%3A//www.this.com/that.html%20%28spaced%29%3Fdata1%3D1%26data2%3D1%23anchor4 encodeURI() => http://www.this.com/that.html%20(spaced)?data1=1&data2=1#anchor4 http://xkr.us/articles/javascript/encode-compare/ http://www.the-art-of-web.com/javascript/escape/ |