转化原理
全角空格unicode编码为12288,半角空格为32
其他字符半角(33-126)与全角(65281-65374)的unicode编码对应关系是:均相差65248
function ToCDB(str) {
var tmp = "";
for(var i=0;i<str.length;i++){
if (str.charCodeAt(i) == 12288){
tmp += String.fromCharCode(32);
continue;
}
if(str.charCodeAt(i) > 65280 && str.charCodeAt(i) < 65375){
tmp += String.fromCharCode(str.charCodeAt(i)-65248);
}
else{
tmp += String.fromCharCode(str.charCodeAt(i));
}
}
return tmp
}