Indy icon indicating copy to clipboard operation
Indy copied to clipboard

TIdHTTPResponseInfo.WriteContent improperly uses IOHandler.Write method

Open Molochnik opened this issue 10 months ago • 4 comments

TIdHTTPResponseInfo.WriteContent uses IOHandler.Write in two places and in both of them incorrectly. It causes wrong message encoding in Lazarus under Linux (unit IdCustomHTTPServer) Now it is (line 2188) :

FConnection.IOHandler.Write(ContentText, CharsetToEncoding(CharSet));

Should be:

FConnection.IOHandler.Write(ContentText, CharsetToEncoding(CharSet){$IFDEF STRING_IS_ANSI}, CharsetToEncoding(CharSet){$ENDIF});

Now it is (line 2213) :

FConnection.IOHandler.Write('<HTML><BODY><B>' + IntToStr(ResponseNo) + ' ' + ResponseText    {Do not Localize}
       + '</B></BODY></HTML>', CharsetToEncoding(CharSet));    {Do not Localize};

Should be:

FConnection.IOHandler.Write('<HTML><BODY><B>' + IntToStr(ResponseNo) + ' ' + ResponseText    {Do not Localize}
       + '</B></BODY></HTML>', CharsetToEncoding(CharSet){$IFDEF STRING_IS_ANSI}, CharsetToEncoding(CharSet){$ENDIF});    {Do not Localize};

Molochnik avatar Sep 10 '23 02:09 Molochnik