<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title>Text Encoding API</title>
<link href="http://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Quicksand:400,700" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Text Encoding API</h1>
<article>
<h2>Versão em Português Brasileiro</h2>
<p>Visualize o exemplo com o console aberto.</p>
<hr>
<h2>English Version</h2>
<p>See the example with the console open.</p>
</article>
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>
<script src="script.js"></script>
</body>
</html>
(function(window){
var encoder = new TextEncoder('utf-16');
var encoded = encoder.encode('The Developers Conference is F#cking awesome!');
var decoder = new TextDecoder('utf-16');
var decoded = decoder.decode(encoded);
console.log('encoded');
console.log(encoded);
console.log('decoded');
console.log(decoded);
}(window));
html,
body {
height: 100%;
width: 100%;
font-family: 'Quicksand', 'Helvetica Neue',Helvetica,Arial, sans-serif;
font-size: 18px;
background: #E7E7E7;
font-weight: 500;
color: #666;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: 'Montserrat', 'Helvetica Neue',Helvetica,Arial,sans-serif;
}
article{
background: #FFF;
padding: 10px;
border-radius: 5px;
width: 90%;
margin: 10px auto;
color: #555;
}
This is a example of TEXT ENCODING API use's case example