function html_encode(str)
{
var s = "";
if (str.length == 0) return "";
s = str.replace(/&/g, "&");
s = s.replace(/</g, "<");
s = s.replace(/>/g, ">");
//s = s.replace(/ /g, " ");
s = s.replace(/\'/g, "'");
s = s.replace(/\"/g, """);
//s = s.replace(/\n/g, "<br>");
return s;
} function html_decode(str)
{
var s = "";
if (str.length == 0) return "";
s = str.replace(/&/g, "&");
s = s.replace(/</g, "<");
s = s.replace(/>/g, ">");
s = s.replace(/ /g, " ");
s = s.replace(/'/g, "\'");
s = s.replace(/"/g, "\"");
s = s.replace(/<br>/g, "\n");
return s;
}
相关文章
- 07-21SERE0014: Illegal HTML character: decimal 154
- 07-21java springmvc mybaits mysql oracle html5 后台框架微信开发,springmvc,mybatis,java,公众平台
- 07-21大约php,mysql,html数字寻呼和文本分页2分页样式供大家参考
- 07-21MySQL 5.5版本解决中文乱码问题时my.ini内[mysqld]项中不能再写default-character-set=utf8
- 07-21mysql: Character set 'utf8mb4' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
- 07-21处理PHP字符串的10个简单方法;mysql出现乱码:character_set_server=utf8
- 07-21html mysql special character
- 07-21html css javascript mysql php学习总结
- 07-21mysql中变量character_set_connection的具体作用
- 07-21MySQL 中NULL和空值的区别 (转载 http://blog.sina.com.cn/s/blog_3f2a82610102v4dn.html)