Welcome to WebmasterWorld Guest from 54.85.162.213

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

HTML BBCodeParser Parser - Issues

BBCode Parser issue, trucates at a space

     
8:55 pm on Apr 18, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Aug 14, 2002
posts:153
votes: 0


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
Foo World [somedomain.com]
After BBCode Parser
<a href="http://www.somedomain.com/Foo">Foo World</a>

Before BBCode Parser
[img w=100 h=99 alt=Enthalpy Wheel]/images/Enthalpy Wheel.png[/img]
After BBCode Parser
<img src="/images/Enthalpy" width="100" height="99" alt="Enthalpy" />

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

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

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.

[edited by: The_Warden at 9:33 pm (utc) on April 18, 2007]

2:36 am on Apr 20, 2007 (gmt 0)

Senior Member

joined:Nov 12, 2005
posts:5967
votes: 0


Hello,

I've never used the PEAR package for this so I cannot say I've run into this same problem. You did say that you have some custom code in there, too. Did this problem arise before or after that custom code was added? You might just be better off writing the whole thing yourself. It's actually quite simple. There are a few threads [google.com] around here that might help you get started.

Another alternative to this would be to post an example of your code and we can try to work it out from there. I'm not quite sure how efficient this will be, though.

3:04 pm on Apr 20, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Aug 14, 2002
posts:153
votes: 0


Thanks for replying eelixduppy. No the custom code is not the problem. This issue exists without adding any additional code. Well I would say yes and no. Well maybe I should write my own however there is more to BBCode parsing then just parsing it directly. For example how to handle if typos, or missing closing tags, or ensuring valid HTML code is outputted. This package is so close to working perfectly for me, except for this one problem. I've tried to read through a few postings here, but maybe I'll try again. Need a solution and fast.

As for posting the code. Well I've given examples of BBCode that cause the problem. Other than that really the code is at the web site for download, [pear.php.net ].

Hello,

I've never used the PEAR package for this so I cannot say I've run into this same problem. You did say that you have some custom code in there, too. Did this problem arise before or after that custom code was added? You might just be better off writing the whole thing yourself. It's actually quite simple. There are a few threads around here that might help you get started.

Another alternative to this would be to post an example of your code and we can try to work it out from there. I'm not quite sure how efficient this will be, though.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members