# Problem encoding HTTP Request

**URL:** <https://forum.uipath.com/t/problem-encoding-http-request/720770>\
**Category:** Studio\
**Tags:** activities-panel, question, studio, webapi, activities\
**Created:** [February 19, 2024, 6:31pm UTC](https://forum.uipath.com/t/problem-encoding-http-request/720770 "2024-02-19T18:31:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuri.santos](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yuri.santos/32/513064_2.png) [@yuri.santos](https://forum.uipath.com/u/yuri.santos)\
**Post date:** [February 19, 2024, 6:31pm UTC](https://forum.uipath.com/t/problem-encoding-http-request/720770/1 "2024-02-19T18:31:15Z")

</div>

Hi all,

Im having trouble encoding the response for a POST Request which has a xml as the body. The response replaces all special caracters for �…

This is my request body: String.Format(“\<?xml version='1.0' encoding='utf-8'?\>\<soap:Envelope xmlns:xsi=‘[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)’ xmlns:xsd=‘[http://www.w3.org/2001/XMLSchema](http://www.w3.org/2001/XMLSchema)’ xmlns:soap=‘[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)’\>soap:Body{0}{1}\</soap:Body\>\</soap:Envelope\>”, firstDayOfMonth, strLastDayOfMonth)

 ![image](https://global.discourse-cdn.com/uipath/original/4X/9/3/8/938ad0f88498811f5a72b64ca170ef9bdbddc846.png)

Headers:

 ![image](https://global.discourse-cdn.com/uipath/original/4X/a/a/1/aa15d28d475c3f6d43e3788437097a2fde883e56.png)

Response is a xml:

 ![image](https://global.discourse-cdn.com/uipath/original/4X/7/e/0/7e0e24051e1cf275035198efb57feb45bf30b082.png)

---

<div class="post-metadata">

**Author:** ![pikorpa](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pikorpa/32/548059_2.png) [@pikorpa](https://forum.uipath.com/u/pikorpa)\
**Post date:** [February 19, 2024, 10:06pm UTC](https://forum.uipath.com/t/problem-encoding-http-request/720770/2 "2024-02-19T22:06:23Z")

</div>

Hey @yuri.santos

Please ensure your POST request specifies the correct `Content-Type` header, typically `application/xml` or `text/xml` for XML data.  
Ensure also that your `Content-Type` header includes the charset, e.g., `Content-Type: application/xml; charset=utf-8`

You can also try to manual decoding. You can use this:

```auto
Dim responseBytes As Byte() = YourHttpResponseContent ' This should be the raw byte array from the response
Dim responseString As String = System.Text.Encoding.UTF8.GetString(responseBytes)

```

Replace `YourHttpResponseContent` with the variable that holds your HTTP response content in byte array form, and ensure you’re using the correct `System.Text.Encoding`

---

<div class="post-metadata">

**Author:** ![yuri.santos](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yuri.santos/32/513064_2.png) [@yuri.santos](https://forum.uipath.com/u/yuri.santos)\
**Post date:** [February 21, 2024, 1:09pm UTC](https://forum.uipath.com/t/problem-encoding-http-request/720770/3 "2024-02-21T13:09:43Z")

</div>

I’ve attempted all the options you mentioned for the ‘header’ argument, but the issue persists. Additionally, I’ve tried manually decoding the response, yet special characters still appear as ‘?’. After consulting with the client, it turns out there was an API problem. It was decoding data as ISO instead of UTF-8, which caused the issue.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [February 26, 2024, 12:59pm UTC](https://forum.uipath.com/t/problem-encoding-http-request/720770/4 "2024-02-26T12:59:23Z")

</div>

Closed on February 26, 2024, 12:59pm UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
