HTML中通过粘贴从MS word引入的所有标点符号都显示为一个小正方形而不是"或"字符在记事本++中显示为"FS"和"GS"and
在纯HTML中。 我尝试使用"DejaVu Sans"字体,但它根本没有帮助。 有什么建议吗?
已结束替换所有违规字符。
String.prototype.replaceAll = function(str1, str2, ignore)
{
return this.replace(new RegExp(str1.replace(/([,!\^${}[]().*+?|<>-&])/g, function(c){return "\" + c;}), "g"+(ignore?"i":"")), str2);
};
然后对于文本的每个单元格:
function cleanHTML(input) {
var output = input.replaceAll('“','"');
output = output.replaceAll('”', '"');
output = output.replaceAll("’", "'");
output = output.replaceAll("‘", "'");
output = output.replaceAll("", "'");
output = output.replaceAll("", "-");
output = output.replaceAll("", "'");
return output;
}
无论其他章程稍后将显示为正方形,我都会为它添加一个替代品。 希望有人能从中受益。