Pm.response.text() can't work properly with chinese

pm.test("Body matches string", function () {

When I use the code above to test weather the response contains the chinese word “健康”,the test fails(The response actually contains the word). I have tried to google for the solutions, but can’t work it out. Hope someone can help.

curl --location ‘’ \

–header ‘Content-Type: application/json;charset=UTF-8’

Hey @wodefan :wave:

Welcome to the Postman community :postman:

Your response is returning JSON, is there a reason you’re trying to assert against the whole response as a string and not target the specific property?

Something like this:

pm.test("Body matches string", function () {

@danny-dainton Thank you for reply.

The example code you post can work properly. I actually know the usage.

I just wonder why pm.expect(pm.response.text()).to.include("健康") doesn’t work, cause I’m learning Postman.

If the more targeted way works and it’s more effective, I’m not sure why the other way would be required.

Without more information or looking deeper into this, I can’t say why that’s not working for you.

When I console log pm.response.text(), I can see that the Chinese characters are being transposed to the Unicode characters.

So your node.header element for example is showing…


Instead of…

"header": "一个更好的世界需要你持续地提出好问题。"

Therefore technically the test is correct. That text is not showing in the parsed response.

When you parse it to JSON, it doesn’t transpose the characters, which is why that is working as expected.

@michaelderekjones You’re right!

The question is that I want to use pm.expect(pm.response.text()).to.include(“健康”) because of its convenience(While using pm.response.json(), I have to designate the exact node by using dot (.) notation).

Is there a solution pm.response.text() can work with Chinese?