phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

Proper urlencoding of "round brackets" in BBCode

Goto page 1, 2  Next
 
Search this topic... | Search General Support... | Search Box
Register or Login to Post    Index » General Support  Previous TopicPrint TopicNext Topic
Author Message
Kim_Possible
Board Member



Joined: 20 Nov 2008

Posts: 7


flag
PostPosted: Fri Nov 28, 2008 8: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? icon_smile.gif
Back to top
drathbun
Board Member



Joined: 24 Jul 2008

Posts: 656
Location: Texas


flag
PostPosted: Sat Nov 29, 2008 4: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. icon_smile.gif 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


flag
PostPosted: Mon Dec 01, 2008 6: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: 656
Location: Texas


flag
PostPosted: Mon Dec 01, 2008 9:02 pm 
Post subject: Re: Proper urlencoding of "round brackets" in BBCo

Heh, I didn't realize that. icon_smile.gif I should, I guess.
_________________
phpBBDoctor Blog
Back to top
Ptirhiik
Board Member



Joined: 19 Nov 2008

Posts: 114


flag
PostPosted: Mon Dec 01, 2008 9: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


flag
PostPosted: Tue Dec 02, 2008 10:25 pm 
Post subject: Re: Proper urlencoding of "round brackets" in BBCo

Further reading if anyone is interested: http://labs.apache.org/webarch/uri/rfc/rfc3986.html#characters
Back to top
drathbun
Board Member



Joined: 24 Jul 2008

Posts: 656
Location: Texas


flag
PostPosted: Wed Dec 03, 2008 2:11 pm 
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. icon_lol.gif

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


flag
PostPosted: Wed Dec 03, 2008 5: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. icon_lol.gif

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
Camp Leader



Joined: 24 Jul 2008

Posts: 72
Location: I Live Here



PostPosted: Sun Dec 07, 2008 5: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 icon_biggrin.gif
Back to top
Kim_Possible
Board Member



Joined: 20 Nov 2008

Posts: 7


flag
PostPosted: Wed Dec 10, 2008 11:51 am 
Post subject: Re: Proper urlencoding of "round brackets" in BBCo

Thanks for the info guys. I learned something new. icon_smile.gif
Back to top
lumpy burgertushie
Board Member



Joined: 19 Nov 2008

Posts: 217


flag
PostPosted: Wed Dec 10, 2008 8: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


flag
PostPosted: Fri May 01, 2009 6: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! icon_lol.gif
Back to top
lumpy burgertushie
Board Member



Joined: 19 Nov 2008

Posts: 217


flag
PostPosted: Sun May 03, 2009 3:12 am 
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



PostPosted: Sun May 03, 2009 4: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


flag
PostPosted: Sun May 03, 2009 8: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? icon_lol.gif
Back to top
Display posts from previous:   
Register or Login to Post    Index » General Support  Previous TopicPrint TopicNext Topic
Page 1 of 2 All times are GMT
Goto page 1, 2  Next
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0279 seconds using 15 queries. (SQL 0.0017 Parse 0.0010 Other 0.0252)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo