Author |
Message |
Kim_Possible Board Member
Joined: 19 Nov 2008
Posts: 7
|
Posted: Fri Nov 28, 2008 4:10 pm Post subject: Proper urlencoding of "round brackets" in BBCode |
|
|
At least I assume that is the problem.
While playing around with my phpBB2 install, I noticed that urls with "( )" in them don't parse properly . . .
Example:
Code: | http://en.wikipedia.org/wiki/Kim_Possible_(character) |
. . . though they are parsed correctly here.
Me
In the interest of enhancing my education, what is the fix? |
|
Back to top |
|
|
drathbun Board Member
Joined: 24 Jul 2008
Posts: 729 Location: Texas
|
Posted: Sat Nov 29, 2008 12:24 pm Post subject: Re: Proper urlencoding of "round brackets" in BBCo |
|
|
http://en.wikipedia.org/wiki/Kim_Possible_(character)
The problem is probably in bbcode.php as that's where the URL is made clickable. In fact the function is called make_clickable().
[Edit]
I think I've figured it out, although I'm not a regexpert. The first preg_replace() call in make_clickable needs to include the ( and ) as valid characters for a URL, and it currently doesn't. I added them here (using quote instead of code so I can highlight the diff:
Quote: | $ret = preg_replace("#([\n ])([a-z]+?)://([a-z0-9\-\.,\?!%\*_\#:;~\(\)\\&$@\/=\+]+)#i", "\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>", $ret);] |
Once I did that the URL's posted. Since the ( was not included as a possible "match" character it was left out of the URL.
I don't know what other implications come out of this. _________________ phpBBDoctor Blog |
|
Back to top |
|
|
Dog Cow Board Member
Joined: 18 Nov 2008
Posts: 378
|
Posted: Mon Dec 01, 2008 2:56 pm Post subject: Re: Proper urlencoding of "round brackets" in BBCo |
|
|
drathbun wrote: |
I don't know what other implications come out of this. |
You're supporting Wikipedia's arrogance that they can get away with whatever they want. Parantheses should NOT be in URLs, since they are illegal characters. Of course, that assumes that you want to play nice and follow the standards. |
|
Back to top |
|
|
drathbun Board Member
Joined: 24 Jul 2008
Posts: 729 Location: Texas
|
Posted: Mon Dec 01, 2008 5:02 pm Post subject: Re: Proper urlencoding of "round brackets" in BBCo |
|
|
Heh, I didn't realize that. I should, I guess. _________________ phpBBDoctor Blog |
|
Back to top |
|
|
Ptirhiik Board Member
Joined: 19 Nov 2008
Posts: 114
|
Posted: Mon Dec 01, 2008 5:17 pm Post subject: Re: Proper urlencoding of "round brackets" in BBCo |
|
|
Indeed, parenthesis have to be properly raw encoded to be valid within an url. The browser does the conversion when requiring the url. |
|
Back to top |
|
|
Dog Cow Board Member
Joined: 18 Nov 2008
Posts: 378
|
|
Back to top |
|
|
drathbun Board Member
Joined: 24 Jul 2008
Posts: 729 Location: Texas
|
Posted: Wed Dec 03, 2008 10:11 am Post subject: Re: Proper urlencoding of "round brackets" in BBCo |
|
|
So what you are saying is that I have just broken phpBB2 as far as apache's standards in order to comply with wiki.
I will probably put it back the way it was, thanks. _________________ phpBBDoctor Blog |
|
Back to top |
|
|
Dog Cow Board Member
Joined: 18 Nov 2008
Posts: 378
|
Posted: Wed Dec 03, 2008 1:46 pm Post subject: Re: Proper urlencoding of "round brackets" in BBCo |
|
|
drathbun wrote: | So what you are saying is that I have just broken phpBB2 as far as apache's standards in order to comply with wiki.
|
Can you say, "Nuclear meltdown"? Plus, I can get the W3C SWAT team on your @$$. Don't make me tell Bertie! |
|
Back to top |
|
|
phpBB2 Refugees Camp Leader
Joined: 24 Jul 2008
Posts: 90 Location: I Live Here
|
Posted: Sun Dec 07, 2008 1:06 pm Post subject: Re: Proper urlencoding of "round brackets" in BBCo |
|
|
The code has been restored to its original state, thanks _________________ Long Live phpBB2 |
|
Back to top |
|
|
Kim_Possible Board Member
Joined: 19 Nov 2008
Posts: 7
|
Posted: Wed Dec 10, 2008 7:51 am Post subject: Re: Proper urlencoding of "round brackets" in BBCo |
|
|
Thanks for the info guys. I learned something new. |
|
Back to top |
|
|
lumpy burgertushie Board Member
Joined: 18 Nov 2008
Posts: 266
|
Posted: Wed Dec 10, 2008 4:14 pm Post subject: Re: Proper urlencoding of "round brackets" in BBCo |
|
|
wiki is not the only ones that allow this. I have seen several posts over the years on the main site about this problem.
some video sites and affiliate sites use the parens in urls.
I usually just tell people not to use them, however, if you are just trying to use a link from somewhere else in your board, you do not have the choice.
robert |
|
Back to top |
|
|
Holger Board Member
Joined: 19 Jan 2009
Posts: 509 Location: Hanover
|
Posted: Fri May 01, 2009 2:00 pm Post subject: Re: Proper urlencoding of "round brackets" in BBCo |
|
|
Sooooo, what do I learn from this?
What happens if I change the code as described above. Do I only have to fear Bertie to whipe my ass? Then it is a fair price! |
|
Back to top |
|
|
lumpy burgertushie Board Member
Joined: 18 Nov 2008
Posts: 266
|
Posted: Sat May 02, 2009 11:12 pm Post subject: Re: Proper urlencoding of "round brackets" in BBCo |
|
|
we learn that you can use the correct encoding for the parens and complain to wikipedia that they are using illegal characters in their urls.
If enough people complain, maybe they will act right.
robert |
|
Back to top |
|
|
Acaria Board Member
Joined: 20 Feb 2009
Posts: 238
|
Posted: Sun May 03, 2009 12:32 am Post subject: Re: Proper urlencoding of "round brackets" in BBCo |
|
|
Pssh, that's like standing on a highway telling a semi going 90 miles an hour to stop. XD
But who knows, maybe they're using a rather intelligent system for allowing those characters? Something that even Apache people would commend?
(Yes, I know what I just said! Wiki doing something like that is rather, well, infeasible, but, hey... XD) |
|
Back to top |
|
|
Holger Board Member
Joined: 19 Jan 2009
Posts: 509 Location: Hanover
|
Posted: Sun May 03, 2009 4:12 pm Post subject: Re: Proper urlencoding of "round brackets" in BBCo |
|
|
Acaria wrote: | Pssh, that's like standing on a highway telling a semi going 90 miles an hour to stop. XD |
Can you please translate that for us Europeans? |
|
Back to top |
|
|
|