i tried this code block, it seems that only replacing qout causes problems
it returns same string as the test but maybe “”" is problem?
function convertHTML(str) {
return str
.replace(/&/g,'&')
.replace(/</g,'<')
.replace(/>/g,'>')
.replace(/"/g,'&qout;')
.replace(/'/g,''')
.replace(/\\/g,'')
}