What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Links ending with a )

Links ending with a )
Author: Message:
macgyver08
Junior Member
**

Avatar
Hakuna matata!

Posts: 23
35 / Male / Flag
Joined: Feb 2007
O.P. Links ending with a )
Does anyone know why links that end with a ) turn out like the following when sent through an IM to someone?:

http://en.wikipedia.com/wiki/Angel_(TV_Series)


And I posted this in the scripting section because I'm having my script sometimes send such links, and was hoping someone here may know how to fix this problem.


This post was edited on 07-23-2010 at 08:57 AM by macgyver08.
07-23-2010 08:57 AM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Links ending with a )
instead of using ( or ) literally, you should encode them... This because ( and ) are actually reserved characters.

http://en.wikipedia.com/wiki/Angel_%28TV_Series%29

( => %28
) => %29

See http://en.wikipedia.org/wiki/Percent-encoding

This encoding can be done in JScript with the escape() function.

In fact, encoding should always be done when you send URLs which you don't know what they'll be, in any program.

;)

This post was edited on 07-25-2010 at 01:41 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
07-23-2010 10:14 AM
Profile PM Find Quote Report
macgyver08
Junior Member
**

Avatar
Hakuna matata!

Posts: 23
35 / Male / Flag
Joined: Feb 2007
O.P. RE: Links ending with a )
Hmm...it's not very aesthetically pleasing with the percentages in the URL. Is that the only way you know of?

This post was edited on 07-23-2010 at 11:42 AM by macgyver08.
07-23-2010 11:40 AM
Profile E-Mail PM Find Quote Report
Chris4
Elite Member
*****

Avatar

Posts: 4461
Reputation: 84
33 / Male / Flag
Joined: Dec 2004
RE: Links ending with a )
A short URL:

http://bit.ly/aEPXZM

A customized short URL:

http://bit.ly/Angel-TV-Series
Twitter: @ChrisLozeau
07-23-2010 02:53 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Links ending with a )
quote:
Originally posted by CookieRevised
( => %29
) => %29
Cookie fail... both parenthesis do not have the same value. It is:
( => %28
) => %29
07-24-2010 06:49 PM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Links ending with a )
quote:
Originally posted by matty
quote:
Originally posted by CookieRevised
( => %29
) => %29
Cookie fail... both parenthesis do not have the same value. It is:
( => %28
) => %29
blah.... copy/paste booboo.... :P fixed
quote:
Originally posted by macgyver08
Hmm...it's not very aesthetically pleasing with the percentages in the URL. Is that the only way you know of?
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

This post was edited on 07-25-2010 at 01:49 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
07-25-2010 01:41 PM
Profile PM Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: Links ending with a )
The "escape" method shouldn't be used for this though:
quote:
Originally posted by JScript docs > escape method
Note
The escape method should not be used to encode Uniform Resource Identifiers (URI). Use encodeURI and encodeURIComponent methods instead.

Unfortunately, using encodeURI doesn't encode parentheses (it appears JScript 5.6 is older than the latest RFC about URIs :P) 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.
07-25-2010 02:29 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Links ending with a )
quote:
Originally posted by Eljay
Unfortunately, using encodeURI doesn't encode parentheses (it appears JScript 5.6 is older than the latest RFC about URIs :P) so it doesn't really help.
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/

This post was edited on 07-25-2010 at 06:10 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
07-25-2010 05:33 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On