Skip to main content

Use encoding

Sets the encoding of the request body

Function UseEncoding(Val Encoding) Export

ParameterCLI optionTypeRequiredDescription
Encoding-StringEncoding name

Returns: DataProcessorObject.OPI_HTTPClient - This processor object


tip

UTF-8 is used by default

caution

NOCLI: this method is not available in CLI version


1C:Enterprise/OneScript code example
    URL = "https://httpbin.org";
URL = URL + "/post";

Text = "Hello world!";
Encoding = "Windows-1251";

Result = OPI_HTTPRequests.NewRequest()
.Initialize(URL)
.UseEncoding(Encoding) // <---
.SetStringBody(Text)
.ProcessRequest("POST")
.ReturnResponseAsJSONObject();