Skip to content

Instantly share code, notes, and snippets.

@03c
Last active December 11, 2023 15:00
Show Gist options
  • Save 03c/bb3b2b6dc1a8b21ba9be1b302055cce0 to your computer and use it in GitHub Desktop.
Save 03c/bb3b2b6dc1a8b21ba9be1b302055cce0 to your computer and use it in GitHub Desktop.
Code Point to Char
<!DOCTYPE html>
<html>
<head>
<title>Font Demo</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght@400&text=person" />
</head>
<body>
<span class="material-symbols-outlined">
person
</span>
<span class="material-symbols-outlined">
</span>
<h1>From code point</h1>
<input type="text" id="codepointInput" placeholder="e.g., e8b6 for search">
<button id="convertButton">Convert</button>
<p></p>
<span id="outputSpan" class="material-symbols-outlined"></span>
<script>
document.getElementById('convertButton').addEventListener('click', function() {
let codepoint = document.getElementById('codepointInput').value;
let char = String.fromCharCode(parseInt(codepoint, 16));
document.getElementById('outputSpan').textContent = char;
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment