javascript: Convert special characters to HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Unicode to HTML converter</title>
</head> <body>
<div id="main">
<script type="text/javascript" charset="utf-8">
//from: http://www.unicodetools.com/unicode/convert-to-html.php
function a(b) {
var c= '';
for(i=0; i<b.length; i++){
if(b.charCodeAt(i)>127){ c += '&#' + b.charCodeAt(i) + ';'; }else{ c += b.charAt(i); }
}
document.forms.conversionForm.outputText.value = c;
}
function sampleText(){
document.forms.conversionForm.inputText.value = "Thére Àre sôme spëcial charâcters ïn thìs têxt 塗聚文";
}
</script>
<h2>Convert special characters to HTML</h2>
<p>
With this tool you are able to encode special characters (chars like 'áèïüñ' '塗聚文'...)
to HTML code. The advantage of using special HTML codes instead of the normal characters is
that the HTML codes will be readable by most users, no matter what charset is used.</p>
<p>
Copy your normal text below. <a href="javascript:sampleText()">Insert sample text</a><br/>
<form name="conversionForm" method="post">
<textarea name="inputText" style="width:400px;height:200px;"></textarea><br/>
<input type="button" name="convert" value="Convert" onclick="a(document.forms.conversionForm.inputText.value)"/>
<br/><br/>Your HTML encoded text:<br/>
<textarea name="outputText" readonly="readonly" style="width:400px;height:200px;"></textarea><br/>
</form>
</p>
</div>
</body> </html>
javascript: Convert special characters to HTML的更多相关文章
- How to use special characters in XML?
https://dvteclipse.com/documentation/svlinter/How_to_use_special_characters_in_XML.3F.html Because X ...
- JavaScript – Convert Image to Base64 String
From: https://bytenota.com/javascript-convert-image-to-base64-string/ his post shows you two approac ...
- [Javascript] Convert a Callback-Based JavaScript Function to a Promise-Based One
Sometimes, you might want to convert a JavaScript function that accepts a callback to one that retur ...
- [Javascript] Convert a forEach method to generator
For example we have a 'forEach' method which can loop though a linked list: forEach(fn) { let node = ...
- How to enter special characters like “&” in oracle database? [duplicate]
SQL> set define off; or use Try 'Java_22 '||'&'||' Oracle_14'
- 六个字符,带你领略JavaScript (js的艺术编写)
正文从这开始- JavaScript是一门神奇且奇妙的编程语言,我们有时候用它来写一些看似疯狂的代码,但这些代码依然可被执行且运行结果十分有趣.JavaScript 试图帮助我们将一些数据类型转化为我 ...
- PHP7函数大全(4553个函数)
转载来自: http://www.infocool.net/kb/PHP/201607/168683.html a 函数 说明 abs 绝对值 acos 反余弦 acosh 反双曲余弦 addcsla ...
- 转:PHP – Best Practises
原文来自于:http://thisinterestsme.com/php-best-practises/ There are a number of good practises that you s ...
- [源码]underscore-1.8.3
// Underscore.js 1.8.3 // http://underscorejs.org // (c) 2009-2015 Jeremy Ashkenas, DocumentCloud an ...
随机推荐
- Difference **面向过程(或者叫结构化)分析方法**面向对象分析方法
面向过程和面向对象的区别 面向过程是分析出解决问题所需要的步骤,然后一步步实现,面向对象是把构成问事件分解成各个对象,建立对象的目的是为了描述某个事物在整个解决问题的步骤中的行为. 可以说面向对象是从 ...
- Java过滤器详细文档,简介,实例,应用
简介 Filter也称之为过滤器,它是Servlet技术中最激动人心的技术,WEB开发人员通过Filter技术,对web服务器管理的所有web资源:例如Jsp, Servlet, 静态图片文件或静态 ...
- gevent 传参, 中文编码
#coding=utf-8 import os from gevent import monkey,pool monkey.patch_all() import gevent import time ...
- EasyUI学习笔记(一)EasyUI入门
一.EasyUI下载 EasyUI官方下载地址:http://www.jeasyui.com/download/index.php,目前最新的版本是:jquery-easyui-1.7.2 解压后得到 ...
- [HNOI2014]抄卡组
[Luogu3234] [LOJ2208] 题解及代码 锻炼哈希码力的一道题 , 具体细节见代码 #include<cstdio> #include<cstring> #inc ...
- 网络寻路(思维+vector的应用)-----------蓝桥备战系列
标题:网络寻路 X 国的一个网络使用若干条线路连接若干个节点.节点间的通信是双向的.某重要数据包,为了安全起见,必须恰好被转发两次到达目的地.该包可能在任意一个节点产生,我们需要知道该网络中一共有多少 ...
- Oracle中对XMLType的简单操作(extract、extractvalue)
前几天一直在做Oracle对XMLType字段的操作,我还不是Oracle大拿,到网上找了很多资料,但是很多就是单一功能的介绍,不能很好的解决问题,现在在这里总结下. 1.下面先创建一个名未test. ...
- C++ GUI Qt4编程(01)-1.1Hello Qt
1. 根据C++ GUI Qt4编程(第二版)整理2. 系统:centos7: Qt版本:5.5.13. 程序:hello.cpp #include <QApplication> #in ...
- PIE SDK文本元素的绘制
1. 功能简介 在数据的处理中会用到文本元素的绘制,利用ITextElement文本元素接口进行绘制,目前PIE SDK支持ITextSymbol符号接口,TextSymbol对象是用于修饰文字元素对 ...
- MVC JSON JavaScriptSerializer 进行序列化或反序列化时出错
MVC control中返回json格式数据一般都是如下格式 [HttpPost] public ActionResult CaseAudit(string name) { var data =&qu ...