[fpc-pascal] fpWeb and html and uri escaping/unescaping elements
José Mejuto
joshyfun at gmail.com
Wed May 25 09:35:58 CEST 2011
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>-<-</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 "-<-" when unescaped but the
code unescapehtml produce "-<-". Explanation step by step:
1) The code looks for all '&'
2) When found replace it by '&'
3) <title> content is now "-<-"
4) Now the code looks for '<'
5) When found replace it by '<'
6) Now title content is "-<-"
----------
Result := StringReplace(s, '&', '&', [rfReplaceAll]);
Result := StringReplace(Result, '<', '<', [rfReplaceAll]);
----------
I hope my explanations are now understandable.
--
Best regards,
José
More information about the fpc-pascal
mailing list