Hebrew content does not work with rest message

Snow Tomcal
Tera Expert

Hi, I have a script that runs a post message, in "outbound rest messages".

Some of my variables are in Hebrew, and when I put the variables in the request body, I get random characters instead of the actual words. i.e: "x*[]"...

Does anyone know of a way to fix this? 

Thanks.

1 REPLY 1

Anand Kumar P
Giga Patron
Giga Patron

Hi @Snow Tomcal ,

To include Hebrew text in your request body, ensure proper encoding. In JavaScript, use encodeURIComponent to encode the text correctly.
Check the 'Content-Type' header of your REST message to 'application/json; charset=UTF-8' to indicate that the request body is in JSON format with UTF-8 encoding.

'/change_request.do?sys_id=-1&sysparm_query=description=' + encodeURIComponent(current.description) 

https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_decodeuricomponent
Please mark it as solution proposed and helpful if it serves your purpose.

Thanks,

Anand