开发者

delphi html decode

开发者 https://www.devze.com 2022-12-10 19:03 出处:网络
I\'m using Delphi 2009 and want to decode an HTML encoded string, for example: ' -> \' But cannot fi开发者_C百科nd any built in function for doing this.

I'm using Delphi 2009 and want to decode an HTML encoded string, for example:

' -> '

But cannot fi开发者_C百科nd any built in function for doing this.

Thanks in advance


Look at the HTTPApp unit. HTTPDecode and HTMLDecode (as well as the Encode functions). You should find this in your Source/Win32/Internet folder.


The HttpApp.HttpDecode function doesn't decode http entities (https://www.w3.org/TR/html4/sgml/entities.html#sym)

For example: ∴

function HtmlDecode(s: UnicodeString): UnicodeString;
{ 
   Public domain: No attribution required
   Known issue, it doesn't handle entities with characters code points above $FFFF (65536)
   e.g.: &
0

精彩评论

暂无评论...
验证码 换一张
取 消