Created
June 28, 2023 19:05
-
-
Save DV8FromTheWorld/2490d4089b51f2ec14cec18693ed1082 to your computer and use it in GitHub Desktop.
Small helper browser console function for pulling info out of the Unicode Confusables site
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getConfusableCharacters() { | |
const confusableCharactersTable = document.querySelector('table:has(h3)') | |
const tableRows = confusableCharactersTable.querySelectorAll('tr') | |
const unicodeRow = Array.from(tableRows[1].children) | |
const nameRow = Array.from(tableRows[2].children) | |
let values = '' | |
for (let i = 0; i < unicodeRow.length; i++) { | |
const unicode = unicodeRow[i].innerText | |
const name = nameRow[i].innerText | |
values += `'\\u{${unicode}}', // ${name}\n` | |
} | |
return values | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script is intended to be run from the browser console when on the Unicode Confusables site
https://util.unicode.org/UnicodeJsps/confusables.jsp
Search for the character that you want to get the confusables for, then open the console, paste this function code, and then run the code.
If in chrome, you can simplify getting the result into your clipboard by using the built in
copy(...)
functionFor example, given a search for
/
: https://util.unicode.org/UnicodeJsps/confusables.jsp?a=%2F&r=None