472,345 Members | 1,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,345 software developers and data experts.

PEAR::HTML_BBCodeParser Parser Issue

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 BBCode tags I've added myself.

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
<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 or directions on how I can resolve this problem would
be much appreciated.

Apr 19 '07 #1
5 2255
thewarden wrote:
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 BBCode tags I've added myself.

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
<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 or directions on how I can resolve this problem would
be much appreciated.
Space is not a valid character in a URL. urlencode() the url before
passing it to the parser.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 19 '07 #2
Thanks for replying. Yes that is true, and I am trying to work this in
some place into the code to resolve this one issue. However this does
not resolve the issue at hand for all the rest that are valid.

On Apr 19, 3:06 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Space is not a valid character in a URL. urlencode() the url before
passing it to the parser.

Apr 20 '07 #3
thewarden wrote:
On Apr 19, 3:06 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>Space is not a valid character in a URL. urlencode() the url before
passing it to the parser.


Thanks for replying. Yes that is true, and I am trying to work this in
some place into the code to resolve this one issue. However this does
not resolve the issue at hand for all the rest that are valid.
(Top posting fixed)

I don't understand - it doesn't resolve the issue for what rest that are
valid?

Using urlencode() won't change an already valid url. It will convert
non-valid characters such as a space to their URL equivalent (i.e. %20).

Is there another problem you're not telling us about?

BTW - please don't top post. Thanks.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 20 '07 #4
On Apr 20, 10:29 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
I don't understand - it doesn't resolve the issue for what rest that are
valid?
Yes. As I the last two examples show valid code that is truncated. Any
time an element has an attribute with a space it gets truncated. This
is very hard to avoid or at least I haven't found a way.
Using urlencode() won't change an already valid url. It will convert
non-valid characters such as a space to their URL equivalent (i.e. %20).
Yes I understand that and I'm trying to figure out how to get
urlencode() into HTML_BBCodeParser. Yet to figure out how to just
apply the urlencoding() onto just the URL itself. Have to do some
regex to grab the URL out I guess and then put it back. Mmmm....

Apr 20 '07 #5
thewarden wrote:
On Apr 20, 10:29 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
>I don't understand - it doesn't resolve the issue for what rest that are
valid?

Yes. As I the last two examples show valid code that is truncated. Any
time an element has an attribute with a space it gets truncated. This
is very hard to avoid or at least I haven't found a way.
>Using urlencode() won't change an already valid url. It will convert
non-valid characters such as a space to their URL equivalent (i.e. %20).

Yes I understand that and I'm trying to figure out how to get
urlencode() into HTML_BBCodeParser. Yet to figure out how to just
apply the urlencoding() onto just the URL itself. Have to do some
regex to grab the URL out I guess and then put it back. Mmmm....
Why not urlencode() it before you pass it off to the parser?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 20 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Louis Aslett | last post by:
Hi, I am extremely stuck trying to port a PHP app from one server to another while making use of the PEAR Mail_mimeDecode package. We have just...
0
by: Robert Oschler | last post by:
I am using XMLHttpRequest() from Javascript on the client side. XMLHttpRequest() expects a valid XML/XHTML document as a response. The target for...
3
by: David | last post by:
I installed the Pear program and set the include path in php.ini to point to the pear dir. I have a program which <? require_once("DB.php"); ...
1
by: David | last post by:
I have code that brings in the Pear DB require_once 'DB.php'; However, there is an include in the DB.php for the PEAR.php file, and the system...
0
by: madsmh | last post by:
When I try ti install DB I get this output: # pear install db downloading DB-1.7.6.tgz ... Starting to download DB-1.7.6.tgz (124,807 bytes)...
5
by: kd | last post by:
I need pear for an offline laptop so the standard install method is no possible. Any suggestions as to how to install pear on the laptop, does...
1
by: Paul | last post by:
I recently upgraded from MySQL 3.23 to 4.1. Now db is not working properly. I'd very much like your help in solving this issue! Here's the code...
3
by: Anthony Smith | last post by:
I always get this message. No matter what package $ pear install Date PHP Warning: Module 'oci8' already loaded in Unknown on line 0 No...
3
by: Rob Wilkerson | last post by:
Hey all - I'm bumping into an issue with my installation of the MDB2 package that I'm hoping someone else has seen. I'm trying to execute a...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.