Forum Discussion

mmoser18's avatar
mmoser18
Frequent Contributor
8 years ago

Extracting UTF-8 text from JSON response

I am trying to define a "Contains"-assertion for JSON responses that contain UTF-8 characters, i.e. the JSON strings contain misc. "national" characters (e.g. in Korean, Chinese, Japanese, etc.), as shown in the first screenshot:

 

Screenshot 1: JSON response containing UTF-8 characters in JSON mode

If I copy-paste such a snippet into the "Contains"-assertion's text fields the snippet will NOT match.

In other cases I noticed that for JSON assertions (in contrast to XML-responses) one needs to copy the response snippet from the Raw-view, not the formatted JSON view to match.

 

But if I switch to raw mode, the UTF-8 characters are not shown properly - see the second screenshot:

 

 

Screenshot 1: JSON response containing UTF-8 characters in Raw mode

 

 

 

 

 

 

 

 

If I copy-paste THIS string into the Assertion's text-field, it does not match, either!

So, can anyone please advise how to grab a snippet from the response using the correct character set and paste it into the text-field such that this "Contains"-assertion will work, i.e. actually match that response?

 

Michael

 

No RepliesBe the first to reply