8

It should be nice to support encodings in Codeunit "Http Web Request Mgt.".


Today function e.g. SendRequestAndReadTextResponse supports only default encoding "TextEncoding::MSDos".

So, I am not able work with e.g. Czech diacritics. :-/


Maybe, it can be better to support TextEncoding::UTF8 which is more general than MSDos, or event better have text encoding as parameter...


    [Scope('OnPrem')]

    procedure SendRequestAndReadTextResponse(var ResponseBody: Text; var ErrorMessage: Text; var ErrorDetails: Text; var HttpStatusCode: DotNet HttpStatusCode; var ResponseHeaders: DotNet NameValueCollection): Boolean

    var

        TempBlob: Codeunit "Temp Blob";

        ResponseInStream: InStream;

        TextLine: Text;

    begin

        if not SendRequestAndReadResponse(TempBlob, ErrorMessage, ErrorDetails, HttpStatusCode, ResponseHeaders) then

            exit(false);


        TempBlob.CreateInStream(ResponseInStream);

TempBlob.CreateInStream(ResponseInStream, TextEncoding::UTF8); // UTF8 or use TextEncoding as parameter...

        while ResponseInStream.ReadText(TextLine) > 0 do

            ResponseBody += TextLine;


        exit(true);

    end;

Category: General
STATUS DETAILS
Needs Votes
Ideas Administrator

Thank you for this suggestion! Currently this is not on our roadmap. We are tracking this idea and if it gathers more votes and comments we will consider it in the future. Best regards, Business Central Team