Chinese characters sent in JSON body to a NodeJS Azure Function are not parsed properly

G-P4cK 1 Reputation point
2020-08-02T10:55:30.683+00:00

I have an HTTP trigger typescript Azure function.
If I make a POST request a body like:

{
  "value": "你好"
}

The content of req.body will be something like:

{
  "value": "ä½ å¥½"
}

I guess it's an encoding problem but I cannot replicate when I run the function locally. Only once it's deployed on Azure...
Any idea why?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,932 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 70,941 Reputation points Moderator
    2020-08-03T06:51:59.45+00:00

    Hi @G-P4cK

    I tried to repro the issue at my end but couldn't observe the same behavior. Can you test the function from the azure portal and confirm if it is the same behavior? Please also verify if there is any change in the Content-Type or any other header while calling the HTTP method.

    Input Parameter:

    15123-02.jpg

    HTTP function and Response
    15124-01.jpg

    Updated:
    Connected offline and perform some tests using Insomnia tool and observe the same issue.
    We perform some more tests using portal and postman test and we couldn't observe the same behavior.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.