function html_encode(str)
{
var s = "";
if (str.length == 0) return "";
s = str.replace(/&/g, "&");
s = s.replace(/</g, "&lt;");
s = s.replace(/>/g, "&gt;");
//s = s.replace(/ /g, "&nbsp;");
s = s.replace(/\'/g, "'");
s = s.replace(/\"/g, "&quot;");
//s = s.replace(/\n/g, "<br>");
return s;
} function html_decode(str)
{
var s = "";
if (str.length == 0) return "";
s = str.replace(/&amp;/g, "&");
s = s.replace(/&lt;/g, "<");
s = s.replace(/&gt;/g, ">");
s = s.replace(/&nbsp;/g, " ");
s = s.replace(/'/g, "\'");
s = s.replace(/&quot;/g, "\"");
s = s.replace(/<br>/g, "\n");
return s;
}

html mysql special character的更多相关文章

  1. 3个问题:MySQL 中 character set 与 collation 的理解;utf8_general_ci 与 utf8_unicode_ci 区别;uft8mb4 默认collation:utf8mb4_0900_ai_ci 的含义

    MySQL 中 character set 与 collation 的理解 出处:https://www.cnblogs.com/EasonJim/p/8128196.html 推荐: 编码使用 uf ...

  2. mysql 中 character set 与 collation 的理解

    character set 和 collation 的是什么? character set, 即字符集. 我们常看到的 utf-8, GB2312, GB18030 都是相互独立的 character ...

  3. MySQL: Connection Character Sets and Collations

    character_set_server collation_servercharacter_set_databasecollation_database character_set_clientch ...

  4. MySQL中character set与collation的理解(转)

    character set和collation的是什么? character set即字符集 我们常看到的UTF-8.GB2312.GB18030都是相互独立的character set.即对Unic ...

  5. 学习笔记:The Best of MySQL Forum

    http://mysql.rjweb.org/bestof.html I have tagged many of the better forum threads. 'Better' is based ...

  6. MySQL之mysql命令使用详解

    MySQL Name mysql - the MySQL command-line tool Synopsis mysql [options] db_name Description mysql is ...

  7. 利用login-path对MySQL安全加固

      Preface       Connection security is  one of the most important safety strategies which we should ...

  8. linux应用之mysql数据库指定版本的yum安装(centos)

    A Quick Guide to Using the MySQL Yum Repository Abstract The MySQL Yum repository provides RPM packa ...

  9. mysql 修改 root 密码

    5.76中加了一些passwd的策略 MySQL's validate_password plugin is installed by default. This will require that ...

随机推荐

  1. vpn pptp配置

    安装 yum install pptpd 配置pptpd 改动/etc/pptpd.conf设置 localip 192.168.20.1 remoteip 192.168.20.234-238,19 ...

  2. Android 它们的定义View (一)

    转载请注明出处:http://blog.csdn.net/lmj623565791/article/details/24252901 非常Android入门程序员AndroidView.可能都是比較恐 ...

  3. windows通过cmd重新启动网卡

    ipconfig/release ipconfig/renew

  4. ASP.NET MVC 学习之路-1

    本文在于巩固基础 学习参考书籍:ASP.NET MVC4 Web编程 首先确定我们学习MVC的目标: 我们学习ASP.NET MVC的目的在于开发健壮的.可维护的Web应用,当然这需要一定的知识基础, ...

  5. CSS垂直水平居中

    小小的总结一下:行内元素水平居中用text-align: center;块级元素水平居中用margin-left: auto; margin-right: auto; 首先讨论一下单行时的情况. 毫无 ...

  6. iOS根据2个经纬度计算距离

    #pragma mark - calculate distance 根据2个经纬度计算距离 #define PI 3.14159265358979323 +(double) CalculationDi ...

  7. EC读书笔记系列之9:条款16、17

    条款16 成对使用new和delete时要采取相同形式 记住: ★若你在new表达式中使用[ ],必须在相应的delete中也使用[ ],反之亦然 -------------------------- ...

  8. js计时器。

    <html> <head> <title> Nonove js clock 时钟 </title> <script type="text ...

  9. leetcode Invert Binary Tree python

    # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = ...

  10. mac os vim 乱码

    yum -y groupinstall chinese-support vim /etc/sysconfig/i18n LANG="zh_CN.UTF-8" LANGUAGE=&q ...