In such cases, try to determine the encoding immediately after getting the text. In your case, the text after immedate downloading is in HTTPSender.Document which is a TMemoryStream. Temporarily save this stream to file. Open this file in NotePad++, it shows in the statusbar that this is an ANSI file, and the HTML header shows that it is CP1252 encoded (but you already seem to know that).
This must ring an alarm: When you do any further processing the encoding will be lost and you will not be able to convert the special characters of this codepage any more correctly.
So, the first thing to do immediately after reading the file from the internet is to convert the encoding to UTF8. In your code of Option2, you do this at the end, and this is too late!
I don't know of a ready-made way to convert the encoding of data stored in a memory stream on the fly. So you must take intermediate steps. One possibility is to store the memory stream to a string variable and convert the encoding - this is your Option 1. Since you seem to require further processing by the html writer you can create the stringstream with this variable and pass this to the ReadHTMLFile procedure:
uses
httpsend, DOM_Html, SAX_HTML, htmwrite, lconvencoding;
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var
HTTPSender: THTTPSend;
doc: thtmldocument;
AStrStr:TStringStream;
htmlStr: String;
begin
HTTPSender := THTTPSend.Create;
try
HTTPSender.HTTPMethod('GET', 'http://blumeninschwaben.de/Einkeimblaettrige/Suessgraeser/suessgraeser.htm');
if (HTTPSender.ResultCode >= 100) and (HTTPSender.ResultCode <= 299) then begin
SetString(htmlStr, PAnsiChar(HTTPSender.Document.Memory), HTTPSender.Document.Size);
AStrStr := TStringStream.Create(ConvertEncoding(htmlStr, EncodingCP1252, EncodingUTF8));
try
ReadHtmlFile(doc, AStrStr);
WriteHTML(doc.DocumentElement, 'test.html');
finally
doc.Free;
AStrStr.Free;
end;
end;
finally
HTTPSender.Free;
end;
end;