JS non-encoding special character issue on Qualtrics | XM Community
Skip to main content

The issue is we are triggering a JSON Workflow event in the following way:

fetch('https://qualtrics-url.com', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'X-API-Token': 'xxx'
},
body: JSON.stringify({var: 'h=fi<una'})
}).then(res => res.json())
.then(res => console.log(res));

From there we send email using the var we passed above. However, in the email we receive, h=fi only, and not the rest of the part. If I do encodeURIComponent, then I receive the full string in encoded format in email, but I want the non-encoded version. If I do encoded, the output will be h%3Dfi%3Cuna instead which also isn't correct.

Any workaround with such issue? I encountered this using JS on Qualtrics.

I think the problem is that the email is html, so < is the start of an html tag. Try h=fi&lt;una


Hi Tom,

So does that mean I can absolutely not get a string containing “<”?  Because this is used to get the password from a file to Qualtrics then sending out, so “<” might be inevitable. 

I guess how to read the < and make it read as &lt; then read out as < in the email….

Sorry I am not very familiar with this. 

Thanks!

I think the problem is that the email is html, so < is the start of an html tag. Try h=fi&lt;una

 


@Donster,

Some characters are reserved in html which includes email unless you specify the email as plain text. < and > are used at the beginning and end of html tags, so to display < and > in html you need to use html entities &lt; and &gt; If you include a < in html you won’t see anything after that unless there is a matching > to close the tag.


Leave a Reply