Hi, my problem is this: when a user post a link with have this signs: [] the url of link broken it, example:
http://www.sld.cu/galerias/pdf/sitios/tuberculosis/tb-labs-cultivo[2].pdf
in the above url, the link is broken in "cultivo" and when I clik in them, the web browser sends me to the wrong link that is broken
please help
There's no way to fix that, seeing how [ and ] are using in bbcode themselves.
About the only option I see is to put the url in code or nobbc tags and have whoever needs the url copy and paste it into their browser's address bar.
http://stackoverflow.com/questions/1547899/which-characters-make-a-url-invalid
answer 59...
Quote
The '[' and ']' characters are <reserved> characters and should be percent escaped if not used as delimiters in the scheme-specific syntax. The spec says:
"URI producing applications should percent-encode data octets that correspond to characters in the reserved set unless these characters are specifically allowed by the URI scheme to represent data in that component."
(Note - the operative work here is "should", and not "shall" or "must". This is advisory, not prescriptive.)
The next sentence of the spec says this:
"If a reserved character is found in a URI component and no delimiting role is known for that character, then it must be interpreted as representing the data octet corresponding to that character's encoding in US-ASCII."
(Note that the operative word is "must". This is saying what a URI means if someone ignores the advice of the previous sentence.)
so, it would seem that using unescaped [ or ] in a URL is improper...
thanks for your answers, you are very kind, and their arguments are correct and entirely valid, but I am looking for a solution to my problem, please if anyone knows what code needs to be altered hope it helps me
It's not doable without rewriting the guts of SMF. I know, I've tried.
Some time ago I remember seeing something about a php BBC parser
Maybe something like this can handle it?
http://jbbcode.com/
Of course, to use it in SMF means... To rewrite its guts :P
It's more than that, you'd have to rewrite part of that parser too.
The easiest way to get around it is to use %5B and %5D respectively for [ and ].
Of course, this requires your members to know how to do this, and takes some time. But it's a workaround for now.
Example: http://www.sld.cu/galerias/pdf/sitios/tuberculosis/tb-labs-cultivo%5B2%5D.pdf
Edit: Phrasing
I wouldn't call that 'easily' ;)
Good point. Edited to re-phrase :P