473,419 Members | 4,195 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 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 2310
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 upgraded from RedHat 7.x to RedHat Enterprise...
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 the request is a PHP4 script running on my web...
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"); ?> This produces the error "Class 'PEAR_Error'...
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 does not appear to be able to locate that file. ...
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) .............................done: 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 anyone have a zip of all pear packages that I can...
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 I used to test it: require_once 'DB.php'; $db...
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 releases available for package "pear.php.net/Date"...
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 query, but get an "unknown error" exception that I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.