In the PageReceived of Xojo.Net.HttpSocket, I need to parse the result data.
For this, I want to convert the Memoryblock to Text or String.
The documentation and all examples say that this is the way to do it:
Dim tResult As Text
tResult = Xojo.Core.TextEncoding.UTF8.ConvertDataToText(Content)
This works fine if the data is indeed UTF8. But what if the response headers say (for example): text/html; charset=CP1256
With the above, it fails with: The data could not be converted to text with this encoding.
How do I handle this correctly?
Or is there a way to convert the Memoryblock to Text/String and then do DefineEncoding/ConvertEncoding after I figured out what it should be?