function winToUtf(text) { var m, i, j, code; m = text.match(/[0-9]{2}[0-9]*;/gi); for (j in m) { var val = '' + m[j]; // buggy IE6 code = intval(val.substr(2, val.length - 3)); if (code >= 32 && ('' + val.replace(/[^0-9]/g, '') + ';' == val)) { // buggy IE6 text = text.replace(val, String.fromCharCode(code)); } } text = text.replace(/"/gi, '"').replace(/&/gi, '&').replace(/</gi, '<').replace(/>/gi, '>'); return text; }