Skip to content

Commit

Permalink
cheat-sheet: Copy UTF16 with '\u'
Browse files Browse the repository at this point in the history
[why]
Makes it even more easy to use, as the '\u' prefix seems to be quite
standard, e.g. for 'echo', 'printf', and even RFC4627.

Reference: #1059

Signed-off-by: Fini Jastrow <[email protected]>
  • Loading branch information
Finii committed Jan 26, 2023
1 parent 8914909 commit eda8f0b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions site.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,10 @@ document.addEventListener('DOMContentLoaded', function () {
textToCopy = '';
let i = 0;
while (i < 10) {
let c = glyph.charCodeAt(i); // js strings are utf16 already :-)
let c = glyph.charCodeAt(i++); // js strings are utf16 already :-)
if (!(c > 0)) break;
if (c < 0x32) continue;
if (i) textToCopy += ' ';
textToCopy += glyph.charCodeAt(i++).toString(16);
if (c <= 0x32) continue;
textToCopy += '\\u' + c.toString(16);
}
}
} else if (parent.className.startsWith('column') && target.className === 'codepoint') {
Expand Down

0 comments on commit eda8f0b

Please sign in to comment.