# Can't set the Content-Type

**URL:** <https://forum.katalon.com/t/cant-set-the-content-type/21635>\
**Category:** Bug Report\
**Tags:** bugs-report, katalon-studio\
**Created:** [March 21, 2019, 4:56am UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635 "2019-03-21T04:56:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![244401716](https://avatars.discourse-cdn.com/v4/letter/2/ebca7d/32.png) [@244401716](https://forum.katalon.com/u/244401716)\
**Post date:** [March 21, 2019, 4:56am UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635/1 "2019-03-21T04:56:00Z")

</div>

I want to do an API test，but the Japanese displayed in the response is scrambled ,I tried to add content-Type,but it didn’t solve the problem of scrambling.

 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/b/b270528918dbee64c133636cca4afc81c17ca613.png)

 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/c/cc6c3ff1892da3642e77feb043863f16728b9535.png)

---

<div class="post-metadata">

**Author:** ![huynguyen](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/huynguyen/32/552_2.png) [@huynguyen](https://forum.katalon.com/u/huynguyen)\
**Post date:** [March 21, 2019, 5:05pm UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635/2 "2019-03-21T17:05:07Z")

</div>

Would you mind sending us the request file (.rs file). We will have more clues to investigate the issue.

---

<div class="post-metadata">

**Author:** ![244401716](https://avatars.discourse-cdn.com/v4/letter/2/ebca7d/32.png) [@244401716](https://forum.katalon.com/u/244401716)\
**Post date:** [March 22, 2019, 2:23am UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635/3 "2019-03-22T02:23:23Z")

</div>

Excuse me ，Where can i find .rs file ?

Besides,this preoblem only appears in Windows,Mac won’t

---

<div class="post-metadata">

**Author:** ![devalex88](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/devalex88/32/336_2.png) [@devalex88](https://forum.katalon.com/u/devalex88)\
**Post date:** [March 22, 2019, 3:47am UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635/4 "2019-03-22T03:47:06Z")

</div>

@huynguyen,

This seems to be an issue with rendering CJK characters (the screenshot said `charset=Shift_JIS`).

@244401716 how was it rendered if you remove `charset` part?

> [@244401716](#):
>
> I tried to add content-Type,but it didn’t solve the problem of scrambling

---

<div class="post-metadata">

**Author:** ![244401716](https://avatars.discourse-cdn.com/v4/letter/2/ebca7d/32.png) [@244401716](https://forum.katalon.com/u/244401716)\
**Post date:** [March 22, 2019, 4:52am UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635/5 "2019-03-22T04:52:07Z")

</div>

If I remove the charset ,the result is the same as the screenshot

I thought it was a charset problem at first ,but in mac,i did API test ,the Japanese part is not scrambled (charset is not set :charset=Shift\_JIS,default charset=UTF-8)

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [March 22, 2019, 6:55am UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635/6 "2019-03-22T06:55:44Z")

</div>

[244401716](http://forum.katalon.com/u/244401716)

Is it possible for you to disclose the URL of your application under test to use?

There are many factors that can cause garbled characters. Therefore we require immediate access to the UAT, otherwise it would be hard to figure out the cause.

---

<div class="post-metadata">

**Author:** ![244401716](https://avatars.discourse-cdn.com/v4/letter/2/ebca7d/32.png) [@244401716](https://forum.katalon.com/u/244401716)\
**Post date:** [March 22, 2019, 7:17am UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635/7 "2019-03-22T07:17:19Z")

</div>

All URLs with Japanese are scrambled like this [https://www.yahoo.co.jp/](https://www.yahoo.co.jp/)

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [March 22, 2019, 8:10am UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635/8 "2019-03-22T08:10:05Z")

</div>

@devalex88

Let me tell you what I saw, and my thought.

I opened `https://www.yahoo.co.jp/` using Katalon Studio API testing UI. The following screenshot shows that the CJK characters in the response body are rendered garbled.

 ![Gabled_CJK_characters_in_HTTP_Response_body](https://europe1.discourse-cdn.com/katalon/original/2X/a/ae2cd198ee3dfea5908d12e5cb503b32e3c9b7b6.png)

I opened `https://www.yahoo.co.jp/` using Chrome.

 ![YahooJPN_no_garbled_characters](https://europe1.discourse-cdn.com/katalon/original/2X/b/b814523282d097badba7e16ebec802744a5dd01b.png)  
The page was encoded in UTF-8, and find the original text is:

> 日本最大級のポータルサイト。検索、オークション、ニュース、天気、スポーツ、メール、ショッピングなど多数のサービスを展開。あなたの生活をより豊かにする「課題解決エンジン」を目指していきます。

I tried to reproduce gabling the UTF-8 encoded characters.  
I used [文字化けさせる奴 - ふくらみ](http://fukurami.hatenablog.com/entry/2017/11/10/000007)

 ![utf-8_encoded_characters_rendered_mistakely_as_MS932](https://europe1.discourse-cdn.com/katalon/original/2X/f/f0ca7f47e08ec80e72554cb5408eb24a89e6a7de.png)  
This interesting tool enabled me to render UTF-8 encoded characters mistakenly as MS932(=SJIS).

The gabled characters reproduced matches exactly with the gabled characters in Katalon Studio.

This proves that, Katalon Studio has a problem rendering the UTF-8 encoded characters. **Katalon Studio does not respect the charset expressed by the HTTP Response Header `Content-type text/html, charset=UTF-8`. It seems rendering the response body with the System’s default charset.**

Eclipse=Katalon Studio has preference setting for the text file encoding. I checked it.

 ![Katalon_preference_text_file_encoding_UTF-8_but](https://europe1.discourse-cdn.com/katalon/original/2X/7/7874e56a19d4992caf1612af2cd135ddd483d51d.png)

The preference is set to be `UTF-8`. However, I believe KS does not respect this setting as well. KS is rendering the Web API Response body always with `Default(MS932)`. This is a problem to be fixed.

Windows PC in Japan has the default encoding to be MS932. But Mac in Japan has the default encoding to be UTF-8. This difference would be the reason why @244401716 says on Mac OK, on Windows NG.

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [March 22, 2019, 8:19am UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635/9 "2019-03-22T08:19:55Z")

</div>

There are many other posts about the same issue

- [api response Chinese display garbled](http://forum.katalon.com/t/api-response-chinese-display-garbled/18454)
- [my API response Chinese display garbled](http://forum.katalon.com/t/my-api-response-chinese-display-garbled/18453)
- [Chinese characters in response data cannot be displayed normally](http://forum.katalon.com/t/chinese-characters-in-response-data-cannot-be-displayed-normally/21723)
- [UTF-8 SOAP Response not correctly displayed in right response window](http://forum.katalon.com/t/utf-8-soap-response-not-correctly-displayed-in-right-response-window/11923/6)

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [April 4, 2019, 1:30am UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635/10 "2019-04-04T01:30:23Z")

</div>

@devalex88, @YoungNgo, @ThanhTo

> [@kazurayam](#):
>
> This proves that, Katalon Studio has a problem rendering the UTF-8 encoded characters. **Katalon Studio does not respect the charset expressed by the HTTP Response Header `Content-type text/html, charset=UTF-8` . It seems rendering the response body with the System’s default charset.**

Do you recognize this issue as a problem of Katalon Studio?

The issue list of katalon studio [Issues · katalon-studio/katalon-studio · GitHub](https://github.com/katalon-studio/katalon-studio/issues) seems to be unaware of this issue.

---

<div class="post-metadata">

**Author:** ![Monster](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/monster/32/1500_2.png) [@Monster](https://forum.katalon.com/u/Monster)\
**Post date:** [April 30, 2019, 10:27am UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635/11 "2019-04-30T10:27:17Z")

</div>

hello,guys. I had the same problem.Recently I have found a solution to this problem  
So, you can try the following solution：  
**1.Add Windows system environment variables** ；  
**name:JAVA\_TOOL\_OPTIONS**  
**path:-Dfile.encoding=UTF-8**  
**2.save it**  
**3.restart your Katalon Studio,**

 ![testclass](https://europe1.discourse-cdn.com/katalon/original/2X/e/e98b27e78c3cf8c7f3e226428bcf7b0a6f972240.png)

If the above steps are not detailed enough, you can visit my blog[testclass](https://www.testclass.cn/katalon_studio_chinese_utf.html).I wrote the detailed instructions, but I used Chinese to write.  
Before configuration modification:

 ![testclass2](https://europe1.discourse-cdn.com/katalon/original/2X/5/5fa56ce5458c6d9704326323f1c78116a66302e1.png)  
After configuration modification:  
 ![testclass3](https://europe1.discourse-cdn.com/katalon/original/2X/4/4a960398f455a828c9732b530c5157b9957d784b.png)

u see it works 😀

---

<div class="post-metadata">

**Author:** ![Monster](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/monster/32/1500_2.png) [@Monster](https://forum.katalon.com/u/Monster)\
**Post date:** [April 30, 2019, 10:28am UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635/12 "2019-04-30T10:28:44Z")

</div>

@[kazurayam](http://forum.katalon.com/u/kazurayam)

---

<div class="post-metadata">

**Author:** ![Monster](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/monster/32/1500_2.png) [@Monster](https://forum.katalon.com/u/Monster)\
**Post date:** [April 30, 2019, 10:29am UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635/13 "2019-04-30T10:29:36Z")

</div>

@devalex88, @YoungNgo, @ThanhTo

---

<div class="post-metadata">

**Author:** ![devalex88](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/devalex88/32/336_2.png) [@devalex88](https://forum.katalon.com/u/devalex88)\
**Post date:** [September 18, 2019, 4:34pm UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635/14 "2019-09-18T16:34:15Z")

</div>

Thank you all for this great feedback. This issue will be addressed in KS 7.0.

---

<div class="post-metadata">

**Author:** ![dnetesov](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@dnetesov](https://forum.katalon.com/u/dnetesov)\
**Post date:** [October 7, 2019, 6:01am UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635/15 "2019-10-07T06:01:17Z")

</div>

really helped me

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/katalon/original/3X/d/5/d55596ab02785a255798e87ede769734747b30c4.svg) [@system](https://forum.katalon.com/u/system)\
**Post date:** [October 3, 2020, 4:55pm UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635/16 "2020-10-03T16:55:24Z")

</div>



---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [October 4, 2020, 12:10am UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635/17 "2020-10-04T00:10:30Z")

</div>

This issue forked into another post:

> [@Katalon.ini should speciify -Dfile.encoding=utf-8](http://forum.katalon.com/t/katalon-ini-should-speciify-dfile-encoding-utf-8/24676):
>
> My experiment I use Katalon Studio v6.1.3, on Windows 10. I made a Test Object for Web Service Request to https://news.yahoo.co.jp/pickup/rss.xml. I tested it and got the following response. The response page displayed non-latin characaters garbled. I wanted to solve this. My study Using Chromes DevTool, I confirmed that the response was in charset=UTF-8: In Katalon Studio, Window \> Katalon Studio Preference \> Gen…

---

<div class="post-metadata">

**Author:** ![lotakeketan](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/lotakeketan/32/11116_2.png) [@lotakeketan](https://forum.katalon.com/u/lotakeketan)\
**Post date:** [January 25, 2021, 3:00am UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635/18 "2021-01-25T03:00:19Z")

</div>

@kazurayam  
@devalex88  
@Monster

I also find garbled value in the response,  
I had all setup mentioned as above and above example( '[https://www.yahoo.co.jp/`](https://www.yahoo.co.jp/%60))works fine with it.  
In my case charset=Shift\_JIS is required, kindly let me know how can I set charset to Shift\_JIS.  
Unfortunately, I cannot share the URL.  
**My Request and Response screenshot:**

 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/b/b677e3d39774639094405577908b8dacd499483c.png)

**My Configurations**

 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/8/8199b4636c4fb30ef6651970599b5f6725f44b89.png)

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [January 25, 2021, 3:38am UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635/19 "2021-01-25T03:38:23Z")

</div>

> [@lotakeketan](#):
>
> In my case charset=Shift\_JIS is required, kindly let me know how can I set charset to Shift\_JIS.

As [Katalon.ini should speciify -Dfile.encoding=utf-8](http://forum.katalon.com/t/katalon-ini-should-speciify-dfile-encoding-utf-8/24676) explains, you should try editing `C:\Users\myname\Katalon_Studio_Windows_64-x.x.x\katalon.ini` so that it includes a line of

```auto
-Dfile.encoding=Shift-JIS

```

You need to stop and restart KS.

Please note, if you change the `katalon.ini` file this way, it is likely that you would encounter character-garbling when you work on other URLs which have charset=utf-8.

~~If you want to set `file.encoding=Shift-JIS` just temporarily for a particular URL, then you may try setting Java SystemProperty `file.encoding` dynamically by

```auto
def previousCharset = System.getProperty('file.encoding') // save the previous charset (possibily UTF-8)
System.setProperty('file.encoding', 'Shift-JIS')
... do anything for your target URL
System.setProperty('file.encoding', previousCharset) // restore the previous charset 

```

 ~~

~~I do not see your test case scripts, so that I have no idea where/how you can do this.~~

---

<div class="post-metadata">

**Author:** ![lotakeketan](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/lotakeketan/32/11116_2.png) [@lotakeketan](https://forum.katalon.com/u/lotakeketan)\
**Post date:** [January 25, 2021, 4:03am UTC](https://forum.katalon.com/t/cant-set-the-content-type/21635/20 "2021-01-25T04:03:47Z")

</div>

@kazurayam

Here Below I sharing my code,

> String URL =‘http://’+serverIP+‘:’+serverPort+‘/’+serverProxyPath+‘/webservice/RbS?command=’+COMMAND+‘&merchantId=’+MERCHANT\_ID+‘&sendingBankCode=’+SENDING\_BANK\_CODE+‘&sendingBranchCode=’+SENDING\_BRANCH\_CODE+‘&sendingTypeOfDeposit=’+SENDING\_TYPE\_OF\_DEPOSIT+‘&sendingAccountNumber=’+SENDING\_ACCOUNT\_NUMBER+‘&sendingAccountHolder=’+SENDING\_ACCOUNT\_HOLDER.replaceAll(“(\p{Z})”, “+”)+‘&hashForFalsificationPrevention=’+this.HASFORFALSIFICATIONPREVENTION  
> WebUI.comment(URL)  
> //Set TestObjectProperty  
> ArrayList headers = new ArrayList()  
> TestObjectProperty header = new TestObjectProperty(“Content-Type”, ConditionType.EQUALS, “text/csv”)  
> headers.add(header)  
> //Set System Properties  
> def previousCharset = System.getProperty(‘file.encoding’)  
> WebUI.comment(previousCharset.toString())  
> System.setProperty(‘file.encoding’, ‘Shift-JIS’)  
> def currentCharset = System.getProperty(‘file.encoding’)  
> WebUI.comment(currentCharset.toString())  
> RequestObject requestObject = new RequestObject(‘’)  
> requestObject.setServiceType(‘REST’)  
> requestObject.setRestUrl(URL)  
> requestObject.setRestRequestMethod(‘GET’)  
> requestObject.setHttpHeaderProperties(headers)  
> //Send the request  
> ResponseObject response = WS.sendRequest(requestObject)  
> //Verify the request  
> WS.verifyResponseStatusCode(response, 200)  
> KeywordUtil.logInfo(response.responseBodyContent)  
> String responseArray = response.responseBodyContent.split(‘,’)  
> WebUI.comment('Response Status code: ’ + (responseArray[0]))

I tried your suggestion for dynamic property change, even though it shows the same response,

> “繝?せ繝医え繧ｧ繧｢ 繝｡繧､繝ｳ繧､繝?”

System property configuration output:

 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/7/7055628a8c953ba2e023bec587e5c3fffe91836b.png)

[Next page](https://forum.katalon.com/t/cant-set-the-content-type/21635.md?page=2)
