Skip to content

Instantly share code, notes, and snippets.

@creationix
Last active June 1, 2025 15:44
Show Gist options
  • Select an option

  • Save creationix/d45b0669e323175d8a705d5e489e3d44 to your computer and use it in GitHub Desktop.

Select an option

Save creationix/d45b0669e323175d8a705d5e489e3d44 to your computer and use it in GitHub Desktop.
This is a base 80 encoding that uses the 40 characters (upper and lower case) of the deseret alphabet invented by pioneers in the mid 1800s. It's not a very useful encoding since it's less efficient than base-16. But it is a pretty fun unicode test since these are high enough in the unicode space to require surrogate pairs in JavaScript.
// ๐œ๐ฎ๐‘… ๐ฎ๐‘† ๐ฉ ๐บ๐ฉ๐‘… 80 ๐ฏ๐‘Œ๐ฟ๐ฌ๐ผ๐ฎ๐‘ ๐‘„๐ฐ๐ป ๐ฒ๐‘…๐ฒ๐‘† ๐‘„ 40 ๐ฟ๐ฐ๐‘‰๐ฎ๐ฟ๐ป๐ฒ๐‘‰๐‘† (๐ฒ๐น๐ฒ๐‘‰ ๐ฐ๐‘Œ๐ผ ๐‘Š๐ต๐ฒ๐‘‰ ๐ฟ๐ฉ๐‘…)
// ๐ฒ๐‘‚ ๐‘„ ๐ผ๐ฏ๐‘…๐จ๐‘‰๐ฏ๐ป ๐ฐ๐‘Š๐‘๐ฐ๐บ๐ฏ๐ป ๐ฎ๐‘Œ๐‘‚๐ฏ๐‘Œ๐ป๐ฒ๐ผ ๐บ๐ด ๐’๐‘‰๐ฎ๐‘€๐ฒ๐‘‹ ๐๐ฒ๐‘ ๐ฎ๐‘Œ ๐‘„ ๐‘‹๐ฎ๐ผ 1800๐ฏ๐‘….
// ๐†๐ป ๐ฎ๐‘† ๐‘Œ๐ช๐ป ๐ฉ ๐‘‚๐ฏ๐‘‰๐จ ๐ท๐ญ๐‘…๐‘๐ฒ๐‘Š ๐ฏ๐‘Œ๐ฟ๐ฌ๐ผ๐ฎ๐‘ ๐‘…๐ฎ๐‘Œ๐‘… ๐ฎ๐ป ๐ฎ๐‘† ๐ฒ๐บ๐ต๐ป ๐ฐ๐‘† ๐ฎ๐‘๐ฎ๐‘‡๐ฒ๐‘Œ๐ป ๐ฐ๐‘† ๐บ๐ฉ๐‘…
// 16. ๐’๐ฒ๐ป ๐ฎ๐ป ๐ฎ๐‘† ๐ฉ ๐น๐‘‰๐ฎ๐ป๐จ ๐‘๐ฒ๐‘Œ unicode ๐ป๐ฏ๐‘…๐ป ๐‘…๐ฎ๐‘Œ๐‘… ๐‘„๐จ๐‘† ๐ช๐‘‰ ๐ธ๐ด ๐ฎ๐‘Œ๐ฒ๐‘ ๐ฎ๐‘Œ ๐‘„
// unicode ๐‘…๐น๐ฉ ๐ป๐ญ ๐‘‰๐ฎ๐ฟ๐ถ๐ด๐ฒ๐‘‰ ๐‘…๐ฒ๐‘‰๐ฒ๐‘€๐ฉ๐ป ๐น๐ฏ๐‘† ๐ฎ๐‘Œ ๐–๐ช๐‘‚๐ฒ๐๐ฟ๐‘‰๐ฎ๐น๐ป.
let ๐”๐ฏ๐‘…๐จ๐‘‰๐ฏ๐ป = '๐€๐๐‚๐ƒ๐„๐…๐†๐‡๐ˆ๐‰๐Š๐‹๐Œ๐๐Ž๐๐๐‘๐’๐“๐”๐•๐–๐—๐˜๐™๐š๐›๐œ๐๐ž๐Ÿ๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง' +
'๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐‘€๐‘๐‘‚๐‘ƒ๐‘„๐‘…๐‘†๐‘‡๐‘ˆ๐‘‰๐‘Š๐‘‹๐‘Œ๐‘๐‘Ž๐‘';
export function ๐’๐ฉ๐‘…๐’๐จ(๐ค๐ฒ๐‘‹๐บ๐ฒ๐‘‰) {
let ๐๐ป๐‘‰๐ฎ๐‘ = '';
while (๐ค๐ฒ๐‘‹๐บ๐ฒ๐‘‰) {
let i = (๐ค๐ฒ๐‘‹๐บ๐ฒ๐‘‰ % 80) << 1;
๐๐ป๐‘‰๐ฎ๐‘ += ๐”๐ฏ๐‘…๐จ๐‘‰๐ฏ๐ป[i] + ๐”๐ฏ๐‘…๐จ๐‘‰๐ฏ๐ป[i + 1];
๐ค๐ฒ๐‘‹๐บ๐ฒ๐‘‰ = (๐ค๐ฒ๐‘‹๐บ๐ฒ๐‘‰ / 80) >>> 0;
}
return ๐๐ป๐‘‰๐ฎ๐‘;
}
@creationix
Copy link
Author

On some Linux systems the built-in fonts don't cover this range. On Ubuntu I ran the following to get near full unicode support:

sudo apt install fonts-noto

@creationix
Copy link
Author

Wikipedia also had links to some great fonts for deseret. https://en.wikipedia.org/wiki/Help:Multilingual_support#Deseret

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment