<!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的更多相关文章

  1. How to use special characters in XML?

    https://dvteclipse.com/documentation/svlinter/How_to_use_special_characters_in_XML.3F.html Because X ...

  2. JavaScript – Convert Image to Base64 String

    From: https://bytenota.com/javascript-convert-image-to-base64-string/ his post shows you two approac ...

  3. [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 ...

  4. [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 = ...

  5. How to enter special characters like “&” in oracle database? [duplicate]

    SQL> set define off; or use Try 'Java_22 '||'&'||' Oracle_14'

  6. 六个字符,带你领略JavaScript (js的艺术编写)

    正文从这开始- JavaScript是一门神奇且奇妙的编程语言,我们有时候用它来写一些看似疯狂的代码,但这些代码依然可被执行且运行结果十分有趣.JavaScript 试图帮助我们将一些数据类型转化为我 ...

  7. PHP7函数大全(4553个函数)

    转载来自: http://www.infocool.net/kb/PHP/201607/168683.html a 函数 说明 abs 绝对值 acos 反余弦 acosh 反双曲余弦 addcsla ...

  8. 转:PHP – Best Practises

    原文来自于:http://thisinterestsme.com/php-best-practises/ There are a number of good practises that you s ...

  9. [源码]underscore-1.8.3

    // Underscore.js 1.8.3 // http://underscorejs.org // (c) 2009-2015 Jeremy Ashkenas, DocumentCloud an ...

随机推荐

  1. JDBC_时间处理_Date_Time_Timestamp区别_随机日期生成

    import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement;import ...

  2. 4.jQuery和DOM 对象之间的相互转换

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  3. @ApiParam @PathVariable @RequestParam三者区别

    转载:https://www.cnblogs.com/xu-lei/p/7803062.html @ApiParam @PathVariable @RequestParam三者区别 1.@ApiPar ...

  4. File 文件操作类 大全

    File  文件操作类  大全 许多人都会对文件操作感到很难  我也是  但是一个好的项目中必定会涉及到文件操作的 文件的复制 粘贴  等等等 公司大佬写了 一个文件操作的工具类 感觉还是棒棒的啦   ...

  5. php 利用 json 传递数组之中文乱码最新解决办法

    json好用,但是如果数据中有中文就会出乱子了,网上解决办法多半是设置utf-8编码或转换字符编码 以下是我的解决办法,利用php的urlencode.urldecode函数(其实也是一种转换编码吧) ...

  6. Bootstrap点击弹出注册登录

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. C++_代码重用3-私有继承

    使用包含:易于理解,类声明中包含表示被包含类的显式命名对象,代码可以通过名称引用这些对象: 使用继承:将使关系更抽象,且继承会引起很多问题,尤其是从多个基类继承时. 私有继承所提供的特性确实比包含多. ...

  8. oracle数据库导入dmp文件

    最近在自己的机子上安装了oracle11g,今天把项目的测试数据库给导入进来了,方便在本地跑起来调试.下面记录一下过程: 1,导出测试数据库的文件; 这个是在公司三楼的一台机子上,用plsql中的工具 ...

  9. C++ GUI Qt4编程(03)-1.3layout

    1. 根据C++ GUI Qt4编程(第二版)整理2. 系统:centos7:  Qt版本:5.5.13. 程序:layout.cpp #include <QApplication> #i ...

  10. python练习七十一:文件操作练习

    假设有关键字存放在text.txt文件中,当用户输入文件中包含的敏感字时,则用星号*替换 例如:用户输入"西安我的故乡"时,则显示为"**我的故乡" 代码; w ...