<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.6000.16544" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=875334509-25052011><FONT face=Arial color=#0000ff size=2><FONT
face="Times New Roman" color=#000000 size=3>> So you suggest to place the
& translation last.</FONT><BR></FONT></SPAN></DIV>
<DIV><SPAN class=875334509-25052011><FONT face=Arial color=#0000ff size=2>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><SPAN class=875334509-25052011><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=875334509-25052011><FONT face=Arial color=#0000ff
size=2>Ludo</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=fr dir=ltr align=left><FONT face=Tahoma
size=2>-----Message d'origine-----<BR><B>De :</B>
fpc-pascal-bounces@lists.freepascal.org
[mailto:fpc-pascal-bounces@lists.freepascal.org] <B>De la part de</B>
ik<BR><B>Envoyé :</B> mercredi 25 mai 2011 09:22<BR><B>À :</B>
FPC-Pascal users discussions<BR><B>Objet :</B> Re: RE : Re[2]:
[fpc-pascal] fpWeb and html and
uriescaping/unescapingelements<BR><BR></FONT></DIV>
<DIV dir=ltr>On Wed, May 25, 2011 at 10:09, Ludo Brands <SPAN dir=ltr><<A
href="mailto:ludo.brands@free.fr">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 face=Arial color=#0000ff size=2>You should not unescape
recursively.</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>Input to EscapeHTML:
'<' Output: '&lt;' : Correct</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>UnescapeHTML:
input '&lt;' Output '<'
Wrong.</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>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 face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>Ludo</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2><FONT
face="Times New Roman" color=#000000
size=3></FONT></FONT></SPAN> </DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV lang=fr dir=ltr align=left><FONT face=Tahoma size=2>-----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 class=h5>
<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">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></BLOCKQUOTE></BODY></HTML>