Re: [twsocket] HTML encoding to char

2011-05-05 Thread Daniele Rocchi
But I was referring to the HTTPApp functions algorithm, not the functions itself. Allocating the maximum possible result string length at the beginning, and using pointers, is usually more efficient than all these copy and concatenation operations you are using in your code. I know, and I

Re: [twsocket] HTML encoding to char

2011-05-04 Thread Daniele Rocchi
Ok, I took your example and created a (I suppose) complete encode-decode unit. Daniele * unit XmlParserUnit; interface uses StrUtils, SysUtils; const XmlNames : Array[1..240] of String = ('quot;',

Re: [twsocket] HTML encoding to char

2011-05-04 Thread RTT
If this is HTML related, why you use XML in the names?! Why not use the faster, and memory efficient, HTTPApp.pas code methods? Ok, I took your example and created a (I suppose) complete encode-decode unit. Daniele -- To unsubscribe or change your settings for TWSocket mailing list please

Re: [twsocket] HTML encoding to char

2011-05-04 Thread Daniele Rocchi
The Xml names are there because I started from the example posted by Anton and I didn't want to create confusion with the existing HTMLEncode/HTMLDecode function already existing. Anyway I never though names would be a problem in a non official unit... The HTTPApp-HTMLDecode function only works

Re: [twsocket] HTML encoding to char

2011-04-21 Thread Anton S.
Delphi HTTPApp unit, function HTMLDecode Wow! I had no idea of this unit, Thanks a lot! HTTP date parsing, Cookies (!), entuity en/decoding... THttpCli might take some useful code from this unit :) But as I see, HTMLEncode touches only special chars. If that's what you need, fine. You may also

Re: [twsocket] HTML encoding to char

2011-04-21 Thread Anton S.
You may also use my function which I wrote for a XML: Ahh, sorry, you need decoding... here's algorythm: 1) Search for 2) Search for ; after 3) Get text between and ; as S 4) idx := AnsiIndexStr(S, XmlEntities); if idx = -1 then ... // Error or ignore 5) replacement char is

[twsocket] HTML encoding to char

2011-04-20 Thread Daniele Rocchi
Hi all, I need to convert text that uses special HTML encoding such as amp; or nbsp; to their corresponding charachter. Do any of you know if such function exists? 'Cause at the moment I'm thinking of writing it myself but it's gonna take quite a while... Daniele -- To unsubscribe or change

Re: [twsocket] HTML encoding to char

2011-04-20 Thread RTT
Delphi HTTPApp unit, function HTMLDecode Hi all, I need to convert text that uses special HTML encoding such as amp; or nbsp; to their corresponding charachter. Do any of you know if such function exists? 'Cause at the moment I'm thinking of writing it myself but it's gonna take quite a

Re: [twsocket] HTML encoding to char

2011-04-20 Thread Daniele Rocchi
Yes, that's what I found on the internet, but then I couldn't find any reference in the Delphi help file. I'll look better, thanks. Daniele On 20 April 2011 16:50, RTT p...@sapo.pt wrote: Delphi HTTPApp unit, function HTMLDecode Hi all, I need to convert text that uses special HTML