
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
Foo World
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.
Re: PEAR::HTML_BBCodeParser Parser Issue
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
> Foo World
>
> 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.
jstucklex [at] attglobal.net
==================
Re: PEAR::HTML_BBCodeParser Parser Issue
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
> Foo World
>
> 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.
jstucklex [at] attglobal.net
==================
Re: PEAR::HTML_BBCodeParser Parser Issue
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... [at] attglobal.net> wrote:
> Space is not a valid character in a URL. urlencode() the url before
> passing it to the parser.
Re: PEAR::HTML_BBCodeParser Parser Issue
thewarden wrote:
> On Apr 19, 3:06 pm, Jerry Stuckle <jstuck... [at] attglobal.net> wrote:
>> 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.
jstucklex [at] attglobal.net
==================
Re: PEAR::HTML_BBCodeParser Parser Issue
On Apr 20, 10:29 am, Jerry Stuckle <jstuck... [at] attglobal.net> wrote:
> 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....
Re: PEAR::HTML_BBCodeParser Parser Issue
thewarden wrote:
> On Apr 20, 10:29 am, Jerry Stuckle <jstuck... [at] attglobal.net> wrote:
>> 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.
jstucklex [at] attglobal.net
==================
Re: PEAR::HTML_BBCodeParser Parser Issue
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... [at] attglobal.net> wrote:
> Space is not a valid character in a URL. urlencode() the url before
> passing it to the parser.
Re: PEAR::HTML_BBCodeParser Parser Issue
thewarden wrote:
> On Apr 19, 3:06 pm, Jerry Stuckle <jstuck... [at] attglobal.net> wrote:
>> 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.
jstucklex [at] attglobal.net
==================
Re: PEAR::HTML_BBCodeParser Parser Issue
On Apr 20, 10:29 am, Jerry Stuckle <jstuck... [at] attglobal.net> wrote:
> 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....
Re: PEAR::HTML_BBCodeParser Parser Issue
thewarden wrote:
> On Apr 20, 10:29 am, Jerry Stuckle <jstuck... [at] attglobal.net> wrote:
>> 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.
jstucklex [at] attglobal.net
==================
PHP » alt.php » PEAR::HTML_BBCodeParser Parser Issue