ampersand (&) is escaped to &
double quotes (") are escaped to "
single quotes (') are escaped to '
less than (<) is escaped to <
greater than (>) is escaped to >
How to apply this with suitescript :
/**
* Replace illegal characters with their HTML entities
* @param {string} str - The string to replace special characters in
* @returns {string} - The modified string with HTML entities
*/
function replaceIllegalCharacters(str) {
str = str.replace(/&/g, '&');
str = str.replace(/"/g, '"');
str = str.replace(/'/g, ''');
str = str.replace(/</g, '<');
str = str.replace(/>/g, '>');
return str;
}