The ScHttpWebRequest1.GetResponse.ReadAsString method expects the response content to be encoded in UTF-8 and decodes it accordingly.
If you encounter issues with accented characters not being displayed correctly, it might indicate that the response is using a different encoding. To retrieve the raw response content without automatic UTF-8 decoding, you can use the following methods:
Once you have the raw response as bytes or a stream, you can apply the correct encoding manually. Here's an example demonstrating how to decode a response that is encoded in ISO 8859-1:
uses ...CLRClasses
...
var
Buf: TBytes;
Str: string;
...
buf := ScHttpWebRequest1.GetResponse.ReadAsBytes;
Str := Encoding.GetEncoding(28591).GetString(Buf, 0, Length(Buf));
...
In this code snippet, 28591 represents the code page identifier for ISO 8859-1, as detailed here. You would replace 28591 with the appropriate code page identifier for the encoding of the response you are receiving.
By retrieving the response as bytes and then explicitly decoding it using the correct encoding, you can ensure that accented characters are handled and displayed properly.