<div dir="ltr"><br><div class="gmail_quote">On Wed, May 25, 2011 at 14:04, Ludo Brands <span dir="ltr"><<a href="mailto:ludo.brands@free.fr">ludo.brands@free.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div class="im">
<div><span><font size="2" color="#0000ff" face="Arial"><font size="3" color="#000000" face="Times New Roman">> So you suggest to place the
& translation last.</font><br></font></span></div>
</div><div><span><font size="2" color="#0000ff" face="Arial">That
would be a solution for this problem. My previous comments on the "minimalistic"
approach of the implementation suggest a different approach: scan the
source string once and replace html entities as you find them (with a look
up table for example). This would scale much better when implementing
iso-8859-1 or '&#entity-number;'
unescaping .</font></span></div></div></blockquote><div><br>For every html entity you need a dictionary, and that's makes your program with more fat.<br>converting number entity can be done, but you need to know what is the code page you wish to convert from/to. <br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div>
<div><span><font size="2" color="#0000ff" face="Arial"></font></span> </div>
<div><span><font size="2" color="#0000ff" face="Arial">Ludo</font></span></div></div></blockquote><div><br>Ido<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>
<blockquote dir="ltr" style="margin-right:0px">
<div></div>
<div dir="ltr" lang="fr" align="left"><font size="2" face="Tahoma"><div class="im">-----Message d'origine-----<br><b>De :</b>
<a href="mailto:fpc-pascal-bounces@lists.freepascal.org" target="_blank">fpc-pascal-bounces@lists.freepascal.org</a>
[mailto:<a href="mailto:fpc-pascal-bounces@lists.freepascal.org" target="_blank">fpc-pascal-bounces@lists.freepascal.org</a>] <b>De la part de</b>
ik<br></div><b>Envoyé :</b> mercredi 25 mai 2011 09:22<div class="im"><br><b>À :</b>
FPC-Pascal users discussions<br></div><b>Objet :</b> Re: RE : Re[2]:
[fpc-pascal] fpWeb and html and
uriescaping/unescapingelements<br><br></font></div><div><div></div><div class="h5">
<div dir="ltr">On Wed, May 25, 2011 at 10:09, Ludo Brands <span dir="ltr"><<a href="mailto:ludo.brands@free.fr" target="_blank">ludo.brands@free.fr</a>></span>
wrote:<br>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="padding-left:1ex;margin:0px 0px 0px 0.8ex;border-left:#ccc 1px solid">
<div>
<div><span><font size="2" color="#0000ff" face="Arial">You should not unescape
recursively.</font></span></div>
<div><span><font size="2" color="#0000ff" face="Arial">Input to EscapeHTML:
'<' Output: '&lt;' : Correct</font></span></div>
<div><span><font size="2" color="#0000ff" face="Arial">UnescapeHTML:
input '&lt;' Output '<'
Wrong.</font></span></div>
<div><span><font size="2" color="#0000ff" face="Arial">This is because you replace
'&' with '&' resulting in '<' which is translated to
'< ' in the next line. </font></span></div></div></blockquote>
<div><br>So you suggest to place the & translation
last.<br> </div>
<blockquote class="gmail_quote" style="padding-left:1ex;margin:0pt 0pt 0pt 0.8ex;border-left:rgb(204,204,204) 1px solid">
<div>
<div><span><font size="2" color="#0000ff" face="Arial"></font></span> </div>
<div><span><font size="2" color="#0000ff" face="Arial">Ludo</font></span></div>
<div><span><font size="2" color="#0000ff" face="Arial"><font size="3" color="#000000" face="Times New Roman"></font></font></span> </div>
<div><span><font size="2" color="#0000ff" face="Arial"></font></span> </div>
<blockquote dir="ltr" style="margin-right:0px">
<div></div>
<div dir="ltr" lang="fr" align="left"><font size="2" face="Tahoma">-----Message
d'origine-----<br><b>De :</b> <a href="mailto:fpc-pascal-bounces@lists.freepascal.org" target="_blank">fpc-pascal-bounces@lists.freepascal.org</a> [mailto:<a href="mailto:fpc-pascal-bounces@lists.freepascal.org" target="_blank">fpc-pascal-bounces@lists.freepascal.org</a>] <b>De la part
de</b> ik<br><b>Envoyé :</b> mercredi 25 mai 2011
08:34<br><b>À :</b> FPC-Pascal users
discussions<br><b>Objet :</b> Re: Re[2]: [fpc-pascal] fpWeb and html
and uri escaping/unescapingelements<br><br></font></div>
<div>
<div></div>
<div>
<div dir="ltr"><br><br><br>
<div class="gmail_quote">On Tue, May 24, 2011 at 12:21, José Mejuto <span dir="ltr"><<a href="mailto:joshyfun@gmail.com" target="_blank">joshyfun@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="padding-left:1ex;margin:0px 0px 0px 0.8ex;border-left:#ccc 1px solid">Hello
FPC-Pascal,<br><br>Tuesday, May 24, 2011, 10:09:03 AM, you
wrote:<br><br>i> I've created a patch with the Escape and unEscape
functions, and place it<br>i> here: <a href="http://bugs.freepascal.org/view.php?id=19407" target="_blank">http://bugs.freepascal.org/view.php?id=19407</a><br><br>Un/escapeHTML
parsing must be in one go, specially the "&" one. Test
against:<br><br>"&lt;"<br></blockquote>
<div><br>I'm not sure what you mean here.<br><br>If you have already html
entities you should not escape them. If you do not have html entities you
should escape them.<br>The Escaping and unescaping works well, I already
tested them before I sent them.<br><br> </div>
<blockquote class="gmail_quote" style="padding-left:1ex;margin:0pt 0pt 0pt 0.8ex;border-left:rgb(204,204,204) 1px solid"><br>Right
unescape "<", your code "<".<br><br>--<br>Best
regards,<br><font color="#888888"> José<br></font></blockquote>
<div><br>Ido<br> </div>
<blockquote class="gmail_quote" style="padding-left:1ex;margin:0pt 0pt 0pt 0.8ex;border-left:rgb(204,204,204) 1px solid"><font color="#888888"></font>
<div>
<div></div>
<div><br>_______________________________________________<br>fpc-pascal
maillist - <a href="mailto:fpc-pascal@lists.freepascal.org" target="_blank">fpc-pascal@lists.freepascal.org</a><br><a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal" target="_blank">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a><br>
</div></div></blockquote></div><br></div></div></div></blockquote></div><br>_______________________________________________<br>fpc-pascal
maillist - <a href="mailto:fpc-pascal@lists.freepascal.org" target="_blank">fpc-pascal@lists.freepascal.org</a><br><a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal" target="_blank">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a><br>
</blockquote></div><br></div></div></div></blockquote></div>
<br>_______________________________________________<br>
fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal" target="_blank">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a><br></blockquote></div><br></div>