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 ...
随机推荐
- pycharm 2016 注册(pycharm-professional-2016.3.2)
BIG3CLIK6F-eyJsaWNlbnNlSWQiOiJCSUczQ0xJSzZGIiwibGljZW5zZWVOYW1lIjoibGFuIHl1IiwiYXNzaWduZWVOYW1lIjoiI ...
- SDUT OJ 数据结构实验之排序八:快速排序
数据结构实验之排序八:快速排序 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Problem Description 给定N ...
- Fast Matrix Operations UVA - 11992 线段树
题意翻译 有一个r行c列的全0矩阵,有以下三种操作. 1 X1 Y1 X2 Y2 v 子矩阵(X1,Y1,X2,Y2)的元素加v 2 X1 Y1 X2 Y2 v 子矩阵(X1,Y1,X2,Y2)的元素 ...
- qt线程睡眠
头文件 #include <QThread> 接口函数: void QThread::sleep ( unsigned long secs ) [static protected] v ...
- web图标icon tomcat图标icon
有时候我们需要更改项目图标为自己的,毕竟tomcat的小猫图标用着不得劲. 你看打开百度等网站时,在地址栏前面就会出现一个蓝色的熊掌状图标或者其他的样式的图标,如果在桌面新建此链接的快捷方式,则桌面图 ...
- struts2学习笔记(一)—— struts2介绍及入门程序
一.struts2概述 1.1 什么是struts2? 在介绍Struts2之前,先来认识一下Struts1.Struts1是最早的基于MVC模式的轻量级web框架,他能够合理的划分代码结构,并包含了 ...
- Flask之flask_script
flask端口占用 解决方案: lsof -i:5000 #查询是哪个进程占用的 kill PID 杀掉进程 flask_script之Manager类 from flask import Flask ...
- 【2-SAT】【并查集】NOIp模拟题 植树方案 题解
一个类似2-SAT的思想,但是简化了很多.只需要用到并查集实现. 题目描述 企鹅国打算种一批树.所谓树,就是由$N$个结点与$N-1$条边连接而成的连通无向图.企鹅国的国王对于这些树有下列要求 ...
- drf(djangorestframework)
一.django restful_framework 核心思想: 缩减编写api接口的代码 Django REST framework是一个建立在Django基础之上的Web 应用开发框架,可以快速的 ...
- 二分函数 lower_bound()
这篇博客说是STL源码.... https://www.cnblogs.com/cobbliu/archive/2012/05/21/2512249.html 头文件 algorithm 1.lowe ...