Encoding URLs

Since Microsoft is using "[LN]" in the addresses (URLs) of KB articles, it would help to have URLs in URL tags encoded as is done by the JavaScript encodeURI function. I have tested a sample encoded URL and it seems to be recognized properly, so it is simply a matter of adding code to do the encode. Without the encoding, a MS KB article with [LN] in it gets messed up.
[390 byte] By [Sam Hobbs] at [2007-11-18 9:52:55]
# 1 Re: Encoding URLs
Sam,

I don't know enough about this encryption. Can you point me to where there is more information on it or post more info here?

Thanks,
Brad
Brad Jones at 2007-11-10 3:37:41 >
# 2 Re: Encoding URLs
Certainly.

First, an online copy of Microsoft's JScript documentation is encodeURI Method (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsmthfencodeuri.asp). The international standard equivalent of JScript (or JavaScript; I get the two confused because they are nearly the same but only one is consistent with the standard) is ECMAScript. A PDF copy of the ECMAScript standard is available at
ECMA-262 (http://www.ecma-international.org/publications/standards/ECMA-262.HTM). In the ECMAScript documentation I find the encodeURI function in paragraph 15.1.3.3.

It is not really encryption, it is encoding. I think the ECMAScript documentation specifies that encodeURI encodes a URI (URL) according to the UTF-8 standard, but I might be misunderstanding that part.
Sam Hobbs at 2007-11-10 3:38:41 >
# 3 Re: Encoding URLs
Note, that I had never such a problem, however, I am enclosing URLs always manually thus they do not get automatically parsed by the forum software...
Andreas Masur at 2007-11-10 3:39:49 >
# 4 Re: Encoding URLs
Originally posted by Andreas Masur
Note, that I had never such a problem, however, I am enclosing URLs always manually thus they do not get automatically parsed by the forum software... How are URLs included if they are not included "manually"?

The problem is that when I include an URL, it is not encoded. Therefore when the URL has "[LN]" in it the address gets messed up. It will happen to you too when you get a KB article URL with "[LN]" in it.

How do you know that an URL is not parsed (unencoded)? The unencoding occurs at the time the link is clicked. If there is nothing to change then there would be no indication that the URL had been unencoded. As far as I know, unencoding occurs automatically by the anchor tag (hyperlink).
Sam Hobbs at 2007-11-10 3:40:43 >
# 5 Re: Encoding URLs
I for one would love to see this resolved. But I don't recall if it's every KB, even with the LN in it, maybe I'm wrong, but I do recall manually having to edit them quite a lot, and I always do a preview before posting a KB article to see if it links correctly. Given the amount of times people post KB's I'm surprised this hasn't come up before...

BTW: good call Sam...I've ignored this for some reason for a long time, I don't know why ;) I thought it was just something goofy with microsoft...

/When in doubt blame it on microsoft.
Mick at 2007-11-10 3:41:45 >
# 6 Re: Encoding URLs
I think the problem does not always happen to me. In other words, URLs for KB articles do not always have "[LN]" in them. I am not sure what the conditions are that cause the URLs to be that way. Perhaps that is a new format and they soon will all have the brackets ("[]") in them.

The following is a sample of an URL I am talking about:

http://support.microsoft.com/default.aspx?scid=kb;[LN];105675

Notice that the opening small bracket is mistakenly interpreted to be not a part of the URL. If that URL is put into an URL tag we get: ;105675]INFO: First and Second Chance Exception Handling (http://support.microsoft.com/default.aspx?scid=kb;[LN) which gets a portion of URL as the beginning of the text for it and it does not work. However if I first encode the URL using the JavaScript encodeURI function I get:

http://support.microsoft.com/default.aspx?scid=kb;%5BLN%5D;105675

Which does work. That text can be used in an URL tag as in: INFO: First and Second Chance Exception Handling (http://support.microsoft.com/default.aspx?scid=kb;%5BLN%5D;105675) and it is that encoding that could be done by the bulletin board software.
Sam Hobbs at 2007-11-10 3:42:51 >
# 7 Re: Encoding URLs
Originally posted by Sam Hobbs
How are URLs included if they are not included "manually"?

There are two ways of adding URLs to a post:

You simply type the URL and it gets automatically enclosed with [URL] tags while sending the post
You type the URL but enclose it directly into [URL] tags

I always use the second method...and with that I had never any problems...
Andreas Masur at 2007-11-10 3:43:53 >
# 8 Re: Encoding URLs
http://support.microsoft.com/default.aspx?scid=kb;[LN];105675

Okay, I'm doing a test with the above URL...

The problem may be in how vBulletin interprets tags. The bracket ([) is an seen as a new tag and that throws vBulletin off when it is trying to automatically parse a URL. You can move the closing URL vBulletin tag to the end manually and the link will work.

Brad
Brad Jones at 2007-11-10 3:44:53 >
# 9 Re: Encoding URLs
Yes you fixed the link. I think you are correct that the opening square bracket is confusing vBulletin. You probably also understand my suggestion that if encoding is possible and if encoding does not cause a problem then encoding could solve this problem. To be a bit more clear, when we push the "http://" button to create a link the URL could be encoded.
Sam Hobbs at 2007-11-10 3:45:50 >
# 10 Re: Encoding URLs
I'm not sure, but I think it would be enough just to add quotes around the URL, like
[URL="http://support.microsoft.com/default.aspx?scid=kb;[LN];105675"]Same URL[/URL]

example:
Same URL (http://support.microsoft.com/default.aspx?scid=kb;[LN];105675)
Yves M at 2007-11-10 3:46:54 >
# 11 Re: Encoding URLs
So let me get this straight. I usually cut and paste, esp with MSDN links. So all I should have to do is paste the link, then enclosed it in URL tags and that should solve it? Just for future reference :)
Mick at 2007-11-10 3:47:51 >
# 12 Re: Encoding URLs
One good reason for doing the encoding is that it is my understanding it is the standard solution. If I am wrong then it could be that it is not a good solution. However however it is done does not matter to us the user very much except it would help to have it done automatically. If quotes is the solution then it would make sense to have it done automatically.
Sam Hobbs at 2007-11-10 3:48:49 >
# 13 Re: Encoding URLs
Originally posted by Mick_2002
So let me get this straight. I usually cut and paste, esp with MSDN links. So all I should have to do is paste the link, then enclosed it in URL tags and that should solve it? Just for future reference :) At least 99.9% of the time I push the "http://" button and the dialog asks for the text for the hyperlink. Then I paste in the document's title and press Ok in the dialog. Then another dialog asks for the address. I paste in the address and press Ok for that. Then I am done, unless I need to do fix-up as discussed here. Oh, actually since the URL tag gets put at the bottom always, I must cut and paste it to where I want it, since I seldom want it at the end.

Many other bulletin boards using this software (or something very similar) paste the tags in-line instead of at the end as does this (version of) the software. I think the at-end pasting is more appropriate for more casual users. For those of us that use this BB often it is an inconvenience to always get the tags pasted at the end. However that is a different problem for a different thread.
Sam Hobbs at 2007-11-10 3:49:52 >
# 14 Re: Encoding URLs
Originally posted by Sam Hobbs One good reason for doing the encoding is that it is my understanding it is the standard solution. If I am wrong then it could be that it is not a good solution. However however it is done does not matter to us the user very much except it would help to have it done automatically. If quotes is the solution then it would make sense to have it done automatically.
I guess that quotes would work all the time, but it's a bit of hack. Anyways, it's true that it would be good if the script inserted the quotes automatically.
Yves M at 2007-11-10 3:50:58 >
# 15 Re: Encoding URLs
Originally posted by Mick_2002
So let me get this straight. I usually cut and paste, esp with MSDN links. So all I should have to do is paste the link, then enclosed it in URL tags and that should solve it? Just for future reference :)
Yes...as I have stated earlier...

You type the URL but enclose it directly into [URL] tags

:cool:
Andreas Masur at 2007-11-10 3:51:59 >