HTML BBCodeParser Parser - Issue

The Warden's picture

He has: 9 posts

Joined: Sep 2002

I've come into a situation where I require to have BBCode parsed, this includes the standard tags supported by PEAR package HTML_BBCodeParser and custom ones.

My problem is this, I've discovered that when an value has a space within the value the value is truncated at the first occurrence of the space. This applies to a URL, image file names and any additional attribute values (alt, style, etc.). This issue is present in the stable release and latest release in CVS for HTML_BBCodeParser. Here is some examples.

Before BBCode Parser
[url=http://www.somedomain.com/Foo World?str=1]Foo World
After BBCode Parser
Foo World

Before BBCode Parser
[img w=100 h=99 alt=Enthalpy Wheel]/images/Enthalpy Wheel.png[/img]
After BBCode Parser
Enthalpy

Before BBCode Parser
[p style=foo bar]something here[/p]
After BBCode Parser
something here

Before BBCode Parser
[div style=color:blue; font-size: 1em;]something here[/div]
After BBCode Parser
something here

This problem appears to exist across the board even without additional BBCode tags or additional attributes.

Any suggestions on how I resolve this problem would be much appreciated.

Busy's picture

He has: 6,151 posts

Joined: May 2001

For one, images names (and file names) should never have a space.

Have you tried single quotes or escaped double quotes ?

\" or ' or \'

The Warden's picture

He has: 9 posts

Joined: Sep 2002

True but it is entirely legal to have a space, you would think there would be URL encoding. Trying to figure out how I can work it in to do it myself. Yes I have tried quotes and tried to escape them. It doesn't seem to work when you use quotes with BBCode Parser. It adds in the quotes where they should be but can't seem to be present before being parsed.

Busy;218167 wrote: For one, images names (and file names) should never have a space.

Have you tried single quotes or escaped double quotes ?

\" or ' or \'

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.