Rest API Converting Japanese character into junk characters
Application Type
Traditional Web

Hi

I am new to Outsystem and I am creating a RESTAPI application. That will accept some input and on click of submit button, it will call a rest API and give us a response.

While consuming the rest API I tested it gave the desired result.

HTTP/1.1 200 OK Content-Type: application/json

(Show all headers)

{  "SiebMsg": {    "IntObjectFormat": "Siebel Hierarchical",    "MessageId": "1-7C86DN",    "IntObjectName": "mffsbucket",    "MessageType": "Integration Object",    "mffsbucket": [      {        "name": "札幌東支店",        "d2ssalesstatus": "",        "materialnum": "QC000001",        "branchcode": "10AB",        "availability": "In Transit",        "listprice": "4950",        "min": "160",        "status": "Good",        "dnprice": "2108",        "partname": "オイル フイルタ",        "safety": "",        "minimunquantity": "12",        "locator1": "",        "max": "200",        "replenishmentflag": "",        "qty": "0"      },      {        "name": "札幌東支店",        "d2ssalesstatus": "",        "materialnum": "QC000001",        "branchcode": "10AB",        "availability": "On Hand",        "listprice": "4950",        "min": "160",        "status": "Good",        "dnprice": "2108",        "partname": "オイル フイルタ",        "safety": "",        "minimunquantity": "12",        "locator1": "C01-3",        "max": "200",        "replenishmentflag": "",        "qty": "398"      },      {        "name": "札幌東支店",        "d2ssalesstatus": "",        "materialnum": "QC000001",        "branchcode": "10AB",        "availability": "Reserved",        "listprice": "4950",        "min": "160",        "status": "Good",        "dnprice": "2108",        "partname": "オイル フイルタ",        "safety": "",        "minimunquantity": "12",        "locator1": "",        "max": "200",        "replenishmentflag": "",        "qty": "13"      }    ]  } }

But on UI it is converting Japanese characters into junk characters. Can someone help how can I solve this issue?

Outerror.png

The Content-Type header did not specify encoding.
When test with Service Studio, it will consider it as UTF-8.
But Unfortunately at runtime, Platform will consider it as ASCII instead of UTF-8.

So you have two options.
1. Change REST Service to return Content-Type with encoding as following

Content-Type: application/json; charset=utf-8


2. If you are not allowed to Change REST Service, you can use OnBeforeRequest of Consume REST.
 In CustomizedRequest, there are RequestBinary and RequestText.
 You need convert RequestBinary to Text with UTF-8, ant then assign it to RequestText


Regards
Wei

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.