CKEditor用ASP.NET发送电子邮件[vb] - 特殊字符问题

时间:2010-09-13 18:25:14

标签: asp.net vb.net ckeditor

我有一个标准的HTML页面,其中包含一个CKEditor包装在一个表单中。 表单提交(POSTS)到Send_Emails.aspx

Send_Emails.aspx将FCKEditor的内容读入变量

Dim html As String = Request.Form("ck_content")

然后发送电子邮件。

问题

字符如:

 -> this seems to show as a special character for blank spaces/carriage returns
’ -> this seems to show as apostrophe's

你能否推荐一些方法来清理这些非标准字符的帖子数据?

由于

1 个答案:

答案 0 :(得分:0)

我想出了如何使用此功能去除不需要的字符:

function removeMSWordChars(str) {
    var myReplacements = new Array();
    var myCode, intReplacement;
    myReplacements[8216] = 39;
    myReplacements[8217] = 39;
    myReplacements[8220] = 34;
    myReplacements[8221] = 34;
    myReplacements[8212] = 45;
    for(c=0; c<str.length; c++) {
        var myCode = str.charCodeAt(c);
        if(myReplacements[myCode] != undefined) {
            intReplacement = myReplacements[myCode];
            str = str.substr(0,c) + String.fromCharCode(intReplacement) + str.substr(c+1);
        }
    }
    return str;
}