Skip to content

Instantly share code, notes, and snippets.

@jdunk
Created March 7, 2017 21:10
Show Gist options
  • Save jdunk/c9cb3af666080a5b33d3b1e595199cdb to your computer and use it in GitHub Desktop.
Save jdunk/c9cb3af666080a5b33d3b1e595199cdb to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<!--
Created using JS Bin
http://jsbin.com
Copyright (c) 2017 by anonymous (http://jsbin.com/erajer/16/edit)
Released under the MIT license: http://jsbin.mit-license.org
-->
<meta name="robots" content="noindex">
<title>Unicode Show Me</title>
<style>
body {
font-family: sans-serif;
}
#theString {
height: 2em;
}
</style>
</head>
<body>
<label>
String: <input type="text" id="theString" value="S̨̥̫͎̭ͯ̿̔̀ͅ">
</label>
<br><button id="theButton">Show Characters</button>
<div id="theResult"></div>
<script>
jQuery(function($) {
$("#theButton").click(function() {
var str, index, len, markup;
str = $("#theString").val();
markup = ["String:&nbsp;&nbsp;&nbsp;&nbsp;" + str];
markup.push("Length: " + str.length);
for (index = 0, len = str.length; index < len; ++index) {
markup.push("[" + index + "]: " +
unicodeLink(str.charCodeAt(index)) +
"&nbsp;&nbsp;&nbsp;&nbsp;" + str.charAt(index));
}
$("#theResult").html("<p>" + markup.join("</p><p>") + "</p>");
});
function unicodeLink(ch) {
var rv = ch.toString(16).toUpperCase();
while (rv.length < 4) {
rv = "0" + rv;
}
return '<a href="http://unicode.org/cldr/utility/character.jsp?a=' + rv + '">U+' + rv + '</a>';
}
});
</script>
<script src="http://static.jsbin.com/js/render/edit.js?3.41.6"></script>
<script>jsbinShowEdit && jsbinShowEdit({"static":"http://static.jsbin.com","root":"http://jsbin.com"});</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-1656750-34', 'auto');
ga('require', 'linkid', 'linkid.js');
ga('require', 'displayfeatures');
ga('send', 'pageview');
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment