Skip to content

Instantly share code, notes, and snippets.

@mapserver2007
Created September 6, 2013 07:11
Show Gist options
  • Save mapserver2007/6460492 to your computer and use it in GitHub Desktop.
Save mapserver2007/6460492 to your computer and use it in GitHub Desktop.
<html>
<head>
<meta charset="utf-8">
<title>test</title>
<script>
window.onload = function() {
var str = "愛";
var bytesize = unescape(encodeURIComponent(str)).length
document.getElementById("test").innerHTML = bytesize;
}
</script>
</head>
<body>
bytesize test<br>
<span id="test"></span>byte
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment