1.数据库存储编码后的字符串
var str = "中文にほんごàꔞnull";
console.log(encodeURI(str));
2.然后读取后解码
console.log(decodeURIComponent(encodeURI(str)));
用于特殊情况,c需要存储用户填写的较长的不确定的UTF-8字符串。
1.数据库存储编码后的字符串
var str = "中文にほんごàꔞnull";
console.log(encodeURI(str));
2.然后读取后解码
console.log(decodeURIComponent(encodeURI(str)));
用于特殊情况,c需要存储用户填写的较长的不确定的UTF-8字符串。