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. Oracle Bills of Material and Engineering Application Program Interface (APIs)

    In this Document Goal   Solution   1. Sample Notes for BOM APIs   2. Datatypes used in these APIs   ...

  2. openstack之horizon源码分析

    一.基础准备: Horizon是基于django webframework开发的标准的Python wsgi程序,django的设计专注于代码的高度可重用,信奉DRY原则,一切面向对象,而Horizo ...

  3. Angular基础知识

    AngularJS 是一个 JavaScript 框架.它可通过 <script> 标签添加到 HTML 页面. AngularJS 通过 ng-directives 扩展了 HTML. ...

  4. node to traverse cannot be null!

    严重: Servlet.service() for servlet springmvc threw exception java.lang.IllegalArgumentException: node ...

  5. C++_转换转子(4种)

    static_cast const_cast dynamic_cast

  6. 《C++ Primer Plus 6th》读书笔记 - 第8章 函数探幽

    1. 摘录 默认参数指的是当函数调用中省略了实参时自动使用的一个值. 默认参数并非编程方面的重大突破,而只是提供了一种便捷的方式.使用默认参数,可以减少要定义的析构函数.方法以及方法重载的数量. 试图 ...

  7. OpenCV学习(1) OpenCV的安装

    前沿 准备了好几天,终于开始了,不管怎样,接下来的这个月一定把这本书很好的啃下来.当然OpenCV可以在很多的IDE下安装与配置,我这里就只在VS2010和VC6.0下安装配置了,当然这篇博文主要讲在 ...

  8. css background-position (图片裁取)

    语法:background-position : length || length background-position : position || position 取值:length  : 百分 ...

  9. http://blog.csdn.net/zhanglvmeng/article/details/11928469

    本系列主要结合<PHP和MYSQL WEB开发 第四版>,在阅读中提出自己认为比较重要的一些问题,以加深对知识的了解程度. 1.简短.中等以及冗长风格的表单变量 $name; //简短风格 ...

  10. Apache commons (Java常用工具包)简介

    Apache Commons是一个非常有用的工具包,解决各种实际的通用问题,下面是一个简述表,详细信息访问http://jakarta.apache.org/commons/index.html Be ...