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 ...
随机推荐
- C# winform间窗体传值简单Demo
form1是用来接收值的 using System; using System.Collections.Generic; using System.ComponentModel; using Syst ...
- [llvm] LLVM 核心类简明示例 : llvm::Value && llvm::Type && llvm::Constant
LLVM 核心类简明示例 : llvm::Value && llvm::Type && llvm::Constant llvm核心类位于 include/llvm/IR ...
- Sql server 千万级大数据SQL查询优化的几点建议
1.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引. 2.应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎放弃使用索 ...
- C语言学习总结(1)——结构体
一,什么是结构体 我们知道数组(Array),它是一组具有相同类型的数据的集合.但在实际的编程过程中,我们往往还需要一组类型不同的数据,例如对于学生信息登记表,姓名为字符串,学号为整数,年龄 ...
- cmder 常用快捷键
双Tab,用于补全 Ctrl+T,建立新页 Ctrl+W,关闭标签页 Ctrl+Tab,切换标签页 Alt+F4,关闭所有标签页 Ctrl+1,切换到第一个页签,Ctrl+2同理 Alt + ente ...
- computed 和 watch 组合使用,监听数据全局数据状态
我要实现的就是,当接口返回数据时,我在任何组件中都能感知到到该数据的变化,然后根据业务逻辑进行处理.展示. 实现这个效果的方式很多,比如当接口返回数据后,就emit这数据,在另外组件中on接收渲染即可 ...
- 执行npm install 时会报 operation not permitted,unlink......错
问题现象:在我这项目目录中执行这命令就会报这个错. 问题原因: 后来查了查,说是 npm 5.4.0版本确实会有这个问题. https://github.com/npm/npm/issues/1828 ...
- Hash 日常摸鱼笔记
本篇文章是Hash在信息学竞赛中的应用的学习笔记,分多次更新(已经有很多坑了) 一维递推 首先是Rabin-Karp,对于一个长度为\(m\)的串\(S\) \(f(S)=\sum_{i=1}^{m} ...
- UVA - 11029 输出前三位
题意:给定\(a\)和\(n\),输出\(a^n\)的前三位和后三位 后三位快速幂 \(log_{10}(a^n)=n*log_{10}(a)=n*log_{10}(x*y),y<10,x mo ...
- an concreate example
Step 1: Creating Parts 1. Split the geometry 2. Create the INLET part. 3. Create the OUTLET part. 4. ...