Hello FPC-Pascal,

Wednesday, May 25, 2011, 8:33:57 AM, you wrote:

>> "<"
i> I'm not sure what you mean here.

That's an already escaped html. Let it be a mini htmlpage:

<html><title>-&amp;lt;-</title></html>

i> If you have already html entities you should not escape them. If you do not
i> have html entities you should escape them.
i> The Escaping and unescaping works well, I already tested them before I sent
i> them.

The right content of <title> tag is "-&lt;-" when unescaped but the
code unescapehtml produce "-<-". Explanation step by step:

1) The code looks for all '&amp;'
2) When found replace it by '&'
3) <title> content is now "-&lt;-"
4) Now the code looks for '&lt;'
5) When found replace it by '<'
6) Now title content is "-<-"

----------
 Result := StringReplace(s,      '&amp;',  '&', [rfReplaceAll]);
 Result := StringReplace(Result, '&lt;',   '<', [rfReplaceAll]);
----------

I hope my explanations are now understandable.

-- 
Best regards,
 José

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to