string-to-unicode-variant
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

𝗎҉ toUnicodeVariant

Javascript function to convert a string into different kind of ⓤⓝⓘⓒⓞⓓⓔ variants.

toUnicodeVariant is an attempt to utilize unicode in a structured, organized and logical manner.

browser

<script src="path/to/toUnicodeVariant.js"></script>

nodejs

const toUnicodeVariant = require('path/to/toUnicodeVariant.js') 

typescript

npm install string-to-unicode-variant
import {string_to_unicode_variant} from "string-to-unicode-variant";

Usage

Pass a string and the name of a variant (or alias), and you get the unicoded' string in return :

toUnicodeVariant(string, variant, combinings)
...
toUnicodeVariant('monospace', 'm') //like first row below 
Variant Alias Description Example
monospace m Monospace 𝚖𝚘𝚗𝚘𝚜𝚙𝚊𝚌𝚎
bold b Bold text 𝐛𝐨𝐥𝐝
italic i Italic text 𝑖𝑡𝑎𝑙𝑖𝑐
bold italic bi bold+italic text 𝒃𝒐𝒍𝒅 𝒊𝒕𝒂𝒍𝒊𝒄
script c Handwriting style 𝓈𝒸𝓇𝒾𝓅𝓉
bold script bc Bolder handwriting 𝓫𝓸𝓵𝓭 𝓼𝓬𝓻𝓲𝓹𝓽
gothic g Gothic (fraktur) 𝔤𝔬𝔱𝔥𝔦𝔠
gothic bold bg Gothic in bold 𝖌𝖔𝖙𝖍𝖎𝖈 𝖇𝖔𝖑𝖉
doublestruck d Outlined text 𝕕𝕠𝕦𝕓𝕝𝕖𝕤𝕥𝕣𝕦𝕔𝕜
𝗌𝖺𝗇𝗌 s Sans-serif style 𝗌𝖺𝗇𝗌
bold 𝗌𝖺𝗇𝗌 bs Bold sans-serif 𝗯𝗼𝗹𝗱 𝘀𝗮𝗻𝘀
italic 𝗌𝖺𝗇𝗌 is Italic sans-serif 𝘪𝘵𝘢𝘭𝘪𝘤 𝘴𝘢𝘯𝘴
bold italic sans bis Bold italic sans-serif 𝙗𝙤𝙡𝙙 𝙞𝙩𝙖𝙡𝙞𝙘 𝙨𝙖𝙣𝙨
circled o Letters within circles ⓒⓘⓡⓒⓛⓔⓓ
circled negative on -- negative 🅒🅘🅡🅒🅛🅔🅓
squared q Letters within squares 🅂🅀🅄🄰🅁🄴🄳
squared negative qn -- negative 🆂🆀🆄🅰🆁🅴🅳
paranthesis p Letters within paranthesis ⒫⒜⒭⒠⒩⒯⒣⒠⒮⒤⒮
fullwidth w Wider monospace font fullwidth
flags f Regional codes 🇩🇰 🇺 🇳 🇮 🇨 🇴 🇩 🇪
numbers dot nd Numbers with trailing dot ⒈⒉⒊⒋
numbers comma nc Numbers with trailing comma 🄂🄃🄄🄅
number double circled ndc Numbers within double circle ⓵⓶⓷⓸
roman r Roman numerals Ⅰ, Ⅱ, ⅯⅯⅩⅩⅢ

Combining with underline, strike and other diacritical marks

The unicoded' text can be combined with a broad range of diacritical marks

toUnicodeVariant('underlined', 'bold italic', 'underline-double')//𝒖̳𝒏̳𝒅̳𝒆̳𝒓̳𝒍̳𝒊̳𝒏̳𝒆̳𝒅̳

Combining Short Sample (italic variant)
strike s 𝑎̶𝑏̶𝑐̶𝑑̶𝑒̶𝑓̶
strike-curly sc 𝑎̴𝑏̴𝑐̴𝑑̴𝑒̴𝑓̴
underline u 𝑎̲𝑏̲𝑐̲𝑑̲𝑒̲𝑓̲
underline-curly uc 𝑎̰𝑏̰𝑐̰𝑑̰𝑒̰𝑓̰
underline-sm u-sm 𝑎̠𝑏̠𝑐̠𝑑̠𝑒̠𝑓̠
underline-double ud 𝑎̳𝑏̳𝑐̳𝑑̳𝑒̳𝑓̳
underline-double-sm ud-sm 𝑎͇𝑏͇𝑐͇𝑑͇𝑒͇𝑓͇
overline o 𝑎̅𝑏̅𝑐̅𝑑̅𝑒̅𝑓̅
overline-curly oc 𝑎̃𝑏̃𝑐̃𝑑̃𝑒̃𝑓̃
overline-sm o-sm 𝑎̄𝑏̄𝑐̄𝑑̄𝑒̄𝑓̄
overline-double od 𝑎̿𝑏̿𝑐̿𝑑̿𝑒̿𝑓̿
slash sl 𝑎̸𝑏̸𝑐̸𝑑̸𝑒̸𝑓̸
cross-above ca 𝑎̽𝑏̽𝑐̽𝑑̽𝑒̽𝑓̽
plus-below pb 𝑎̟𝑏̟𝑐̟𝑑̟𝑒̟𝑓̟
enclose-circle en-c 𝑎⃝ 𝑏⃝ 𝑐⃝ 
enclose-circle-backslash en-cb 𝑎⃠ 𝑏⃠ 𝑐⃠ 
enclose-square en-s 𝑎⃞ 𝑏⃞ 𝑐⃞ 
enclose-diamond en-d 𝑎⃟ 𝑏⃟ 𝑐⃟ 
enclose-screen en-scr 𝑎⃢ 𝑏⃢ 𝑐⃢ 
enclose-keycap en-k 𝑎⃣ 𝑏⃣ 𝑐⃣ 
halo-breve hb 𝖺҈ 𝖻҈ 𝖼҈ 
halo-grave hg 𝖺҉ 𝖻҉ 𝖼҉ 
𝑛-above {a..x}-a 𝑎ͣ𝑎ͨ𝑎ͩ𝑎ͤ𝑎ͪ𝑎ͥ𝑎ͫ𝑎ͦ𝑎ͬ𝑎ͧ𝑎ͮ𝑎ͯ
🔎 Compatibility table: Variants / combinings
s sc u uc u-sm ud ud-sm o oc o-sm od sl a-a c-a d-a e-a h-a i-a m-a r-a u-a v-a x-a ca pb en-c en-cb en-s en-d en-scr en-k hb hg
monospace 𝚊̶ 𝚊̴ 𝚊̲ 𝚊̰ 𝚊̠ 𝚊̳ 𝚊͇ 𝚊̅ 𝚊̃ 𝚊̄ 𝚊̿ 𝚊̸ 𝚊ͣ 𝚊ͨ 𝚊ͩ 𝚊ͤ 𝚊ͪ 𝚊ͥ 𝚊ͫ 𝚊ͬ 𝚊ͧ 𝚊ͮ 𝚊ͯ 𝚊̽ 𝚊̟ 𝚊⃝ 𝚊⃠ 𝚊⃞ 𝚊⃟ 𝚊⃢ 𝚊⃣ - -
bold 𝐚̶ 𝐚̴ 𝐚̲ 𝐚̰ 𝐚̠ 𝐚̳ 𝐚͇ 𝐚̅ 𝐚̃ 𝐚̄ 𝐚̿ 𝐚̸ 𝐚ͣ 𝐚ͨ 𝐚ͩ 𝐚ͤ 𝐚ͪ 𝐚ͥ 𝐚ͫ 𝐚ͬ 𝐚ͧ 𝐚ͮ 𝐚ͯ 𝐚̽ 𝐚̟ 𝐚⃝ 𝐚⃠ 𝐚⃞ 𝐚⃟ 𝐚⃢ 𝐚⃣ - -
italic 𝑎̶ 𝑎̴ 𝑎̲ 𝑎̰ 𝑎̠ 𝑎̳ 𝑎͇ 𝑎̅ 𝑎̃ 𝑎̄ 𝑎̿ 𝑎̸ 𝑎ͣ 𝑎ͨ 𝑎ͩ 𝑎ͤ 𝑎ͪ 𝑎ͥ 𝑎ͫ 𝑎ͬ 𝑎ͧ 𝑎ͮ 𝑎ͯ 𝑎̽ 𝑎̟ 𝑎⃝ 𝑎⃠ 𝑎⃞ 𝑎⃟ 𝑎⃢ 𝑎⃣ - -
bold italic 𝒂̶ 𝒂̴ 𝒂̲ 𝒂̰ 𝒂̠ 𝒂̳ 𝒂͇ 𝒂̅ 𝒂̃ 𝒂̄ 𝒂̿ 𝒂̸ 𝒂ͣ 𝒂ͨ 𝒂ͩ 𝒂ͤ 𝒂ͪ 𝒂ͥ 𝒂ͫ 𝒂ͬ 𝒂ͧ 𝒂ͮ 𝒂ͯ 𝒂̽ 𝒂̟ 𝒂⃝ 𝒂⃠ 𝒂⃞ 𝒂⃟ 𝒂⃢ 𝒂⃣ - -
script 𝒶̶ 𝒶̴ 𝒶̲ 𝒶̰ 𝒶̠ 𝒶̳ 𝒶͇ 𝒶̅ 𝒶̃ 𝒶̄ 𝒶̿ 𝒶̸ 𝒶ͣ 𝒶ͨ 𝒶ͩ 𝒶ͤ 𝒶ͪ 𝒶ͥ 𝒶ͫ 𝒶ͬ 𝒶ͧ 𝒶ͮ 𝒶ͯ 𝒶̽ 𝒶̟ 𝒶⃝ 𝒶⃠ 𝒶⃞ 𝒶⃟ 𝒶⃢ 𝒶⃣ - -
bold script 𝓪̶ 𝓪̴ 𝓪̲ 𝓪̰ 𝓪̠ 𝓪̳ 𝓪͇ 𝓪̅ 𝓪̃ 𝓪̄ 𝓪̿ 𝓪̸ 𝓪ͣ 𝓪ͨ 𝓪ͩ 𝓪ͤ 𝓪ͪ 𝓪ͥ 𝓪ͫ 𝓪ͬ 𝓪ͧ 𝓪ͮ 𝓪ͯ 𝓪̽ 𝓪̟ 𝓪⃝ 𝓪⃠ 𝓪⃞ 𝓪⃟ 𝓪⃢ 𝓪⃣ - -
gothic 𝔞̶ 𝔞̴ 𝔞̲ 𝔞̰ 𝔞̠ 𝔞̳ 𝔞͇ 𝔞̅ 𝔞̃ 𝔞̄ 𝔞̿ 𝔞̸ 𝔞ͣ 𝔞ͨ 𝔞ͩ 𝔞ͤ 𝔞ͪ 𝔞ͥ 𝔞ͫ 𝔞ͬ 𝔞ͧ 𝔞ͮ 𝔞ͯ 𝔞̽ 𝔞̟ 𝔞⃝ 𝔞⃠ 𝔞⃞ 𝔞⃟ 𝔞⃢ 𝔞⃣ - -
gothic bold 𝖆̶ 𝖆̴ 𝖆̲ 𝖆̰ 𝖆̠ 𝖆̳ 𝖆͇ 𝖆̅ 𝖆̃ 𝖆̄ 𝖆̿ 𝖆̸ 𝖆ͣ 𝖆ͨ 𝖆ͩ 𝖆ͤ 𝖆ͪ 𝖆ͥ 𝖆ͫ 𝖆ͬ 𝖆ͧ 𝖆ͮ 𝖆ͯ 𝖆̽ 𝖆̟ 𝖆⃝ 𝖆⃠ 𝖆⃞ 𝖆⃟ 𝖆⃢ 𝖆⃣ - -
doublestruck 𝕒̶ 𝕒̴ 𝕒̲ 𝕒̰ 𝕒̠ 𝕒̳ 𝕒͇ 𝕒̅ 𝕒̃ 𝕒̄ 𝕒̿ 𝕒̸ - - - - - - - - - - - 𝕒̽ 𝕒̟ - - - - - - 𝕒҈ 𝕒҉
sans 𝖺̶ 𝖺̴ 𝖺̲ 𝖺̰ 𝖺̠ 𝖺̳ 𝖺͇ 𝖺̅ 𝖺̃ 𝖺̄ 𝖺̿ 𝖺̸ - - - - - - - - - - - 𝖺̽ 𝖺̟ - - - - - - 𝖺҈ 𝖺҉
bold sans 𝗮̶ 𝗮̴ 𝗮̲ 𝗮̰ 𝗮̠ 𝗮̳ 𝗮͇ 𝗮̅ 𝗮̃ 𝗮̄ 𝗮̿ 𝗮̸ - - - - - - - - - - - 𝗮̽ 𝗮̟ - - - - - - - -
italic sans 𝘢̶ 𝘢̴ 𝘢̲ 𝘢̰ 𝘢̠ 𝘢̳ 𝘢͇ 𝘢̅ 𝘢̃ 𝘢̄ 𝘢̿ 𝘢̸ - - - - - - - - - - - 𝘢̽ 𝘢̟ - - - - - - - -
bold italic sans 𝙖̶ 𝙖̴ 𝙖̲ 𝙖̰ 𝙖̠ 𝙖̳ 𝙖͇ 𝙖̅ 𝙖̃ 𝙖̄ 𝙖̿ 𝙖̸ - - - - - - - - - - - 𝙖̽ 𝙖̟ - - - - - - - -
parenthe - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
squared - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
squared neg - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
circled - - - - - - - - - ⓐ̄ - - - - - - - - - - - - - - - - - - - - - - -
circled neg. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
fullwidth - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

You can control the space between each character by using space-combinings. In the above table, rendering of the halo- and enclose- samples are used along with a space-en to make them look nicer.

🔎 Compatibility table: Combining spaces
space-zero space-hair space-thin space space-en space-figure space-cjk space-em space-ogham
monospace 𝚊𝚣 𝚊 𝚣  𝚊 𝚣  𝚊 𝚣 𝚊 𝚣  𝚊 𝚣  𝚊 𝚣  𝚊 𝚣  𝚊 𝚣 
bold 𝐚𝐳 𝐚 𝐳  𝐚 𝐳  𝐚 𝐳 𝐚 𝐳  𝐚 𝐳  𝐚 𝐳  𝐚 𝐳  𝐚 𝐳 
italic 𝑎𝑧 𝑎 𝑧  𝑎 𝑧  𝑎 𝑧 𝑎 𝑧  𝑎 𝑧  𝑎 𝑧  𝑎 𝑧  𝑎 𝑧 
bold italic 𝒂𝒛 𝒂 𝒛  𝒂 𝒛  𝒂 𝒛 𝒂 𝒛  𝒂 𝒛  𝒂 𝒛  𝒂 𝒛  𝒂 𝒛 
script 𝒶𝓏 𝒶 𝓏  𝒶 𝓏  𝒶 𝓏 𝒶 𝓏  𝒶 𝓏  𝒶 𝓏  𝒶 𝓏  𝒶 𝓏 
bold script 𝓪𝔃 𝓪 𝔃  𝓪 𝔃  𝓪 𝔃 𝓪 𝔃  𝓪 𝔃  𝓪 𝔃  𝓪 𝔃  𝓪 𝔃 
gothic 𝔞𝔷 𝔞 𝔷  𝔞 𝔷  𝔞 𝔷 𝔞 𝔷  𝔞 𝔷  𝔞 𝔷  𝔞 𝔷  𝔞 𝔷 
gothic bold 𝖆𝖟 𝖆 𝖟  𝖆 𝖟  𝖆 𝖟 𝖆 𝖟  𝖆 𝖟  𝖆 𝖟  𝖆 𝖟  𝖆 𝖟 
doublestruck 𝕒𝕫 𝕒 𝕫  𝕒 𝕫  𝕒 𝕫 𝕒 𝕫  𝕒 𝕫  𝕒 𝕫  𝕒 𝕫  𝕒 𝕫 
sans 𝖺𝗓 𝖺 𝗓  𝖺 𝗓  𝖺 𝗓 𝖺 𝗓  𝖺 𝗓  𝖺 𝗓  𝖺 𝗓  𝖺 𝗓 
bold sans 𝗮𝘇 𝗮 𝘇  𝗮 𝘇  𝗮 𝘇 𝗮 𝘇  𝗮 𝘇  𝗮 𝘇  𝗮 𝘇  𝗮 𝘇 
italic sans 𝘢𝘻 𝘢 𝘻  𝘢 𝘻  𝘢 𝘻 𝘢 𝘻  𝘢 𝘻  𝘢 𝘻  𝘢 𝘻  𝘢 𝘻 
bold italic sans 𝙖𝙯 𝙖 𝙯  𝙖 𝙯  𝙖 𝙯 𝙖 𝙯  𝙖 𝙯  𝙖 𝙯  𝙖 𝙯  𝙖 𝙯 
parenthe ⒜⒵ ⒜ ⒵  ⒜ ⒵  ⒜ ⒵ ⒜ ⒵  ⒜ ⒵  ⒜ ⒵  ⒜ ⒵  ⒜ ⒵ 
squared 🄰🅉 🄰 🅉  🄰 🅉  🄰 🅉 🄰 🅉  🄰 🅉  🄰 🅉  🄰 🅉  🄰 🅉 
squared neg 🅰🆉 🅰 🆉  🅰 🆉  🅰 🆉 🅰 🆉  🅰 🆉  🅰 🆉  🅰 🆉  🅰 🆉 
circled ⓐⓩ ⓐ ⓩ  ⓐ ⓩ  ⓐ ⓩ ⓐ ⓩ  ⓐ ⓩ  ⓐ ⓩ  ⓐ ⓩ  ⓐ ⓩ 
circled neg. 🅐🅩 🅐 🅩  🅐 🅩  🅐 🅩 🅐 🅩  🅐 🅩  🅐 🅩  🅐 🅩  🅐 🅩 
fullwidth az a z  a z  a z a z  a z  a z  a z  a z 
flags 🇩🇰 🇩 🇰  🇩 🇰  🇩 🇰 🇩 🇰  🇩 🇰  🇩 🇰  🇩 🇰  🇩 🇰 
numbers dot
numbers comma 🄂🄃 🄂 🄃  🄂 🄃  🄂 🄃 🄂 🄃  🄂 🄃  🄂 🄃  🄂 🄃  🄂 🄃 
numbers dc ⓵⓶ ⓵ ⓶  ⓵ ⓶  ⓵ ⓶ ⓵ ⓶  ⓵ ⓶  ⓵ ⓶  ⓵ ⓶  ⓵ ⓶ 

Combinings can be combined

You can use two, three or more combinings either by passing a comma separated string, or by passing an array of strings :

toUnicodeVariant('The quick brown fox jumps ...', 'sans', 'underline, overline, strike')
toUnicodeVariant('The quick brown fox jumps ...', 'sans', ['underline', 'overline', 'strike'])

𝖳̶̲̅𝗁̶̲̅𝖾̶̲̅ ̶̲̅𝗊̶̲̅𝗎̶̲̅𝗂̶̲̅𝖼̶̲̅𝗄̶̲̅ ̶̲̅𝖻̶̲̅𝗋̶̲̅𝗈̶̲̅𝗐̶̲̅𝗇̶̲̅ ̶̲̅𝖿̶̲̅𝗈̶̲̅𝗑̶̲̅ ̶̲̅𝗃̶̲̅𝗎̶̲̅𝗆̶̲̅𝗉̶̲̅𝗌̶̲̅ ̶̲̅𝗈̶̲̅𝗏̶̲̅𝖾̶̲̅𝗋̶̲̅ ̶̲̅𝗍̶̲̅𝗁̶̲̅𝖾̶̲̅ ̶̲̅𝗅̶̲̅𝖺̶̲̅𝗓̶̲̅𝗒̶̲̅ ̶̲̅𝖽̶̲̅𝗈̶̲̅𝗀̶̲̅

You can use shorthand aliases or a mix, 'u,o,s', ['u','o','strike'] etc.

Special chars

Language specific special chars like ç, ò or ø are not supported by any unicode "variant", and will almost certainly never be in any future. The script and gothic fonts are in fact just various kind of mathematical symbols (see references below). For many of the variants, converting a special char like ø will at best look odd, probably ruin the entire string (vary on reader / browser).

But -- by using the base latin character as fallback, and inject a makeover of diacritical marks, we can experimentally try to mimick some language specific characters. Adding diacritics fails with the figurative variants, but it works okay with most of the rest.

🔎 Table of mimicked special chars, 𝗮̂ to 𝗼̷
# mono space bold italic bold italic script bold script gothic gothic bold double struck sans bold sans italic sans bold italic sans
ä 𝚊̈ 𝐚̈ 𝑎̈ 𝚊̈ 𝒶̈ 𝓪̈ 𝔞̈ 𝖆̈ 𝕒̈ 𝖺̈ 𝗮̈ 𝘢̈ 𝙖̈
â 𝚊̂ 𝐚̂ 𝑎̂ 𝚊̂ 𝒶̂ 𝓪̂ 𝔞̂ 𝖆̂ 𝕒̂ 𝖺̂ 𝗮̂ 𝘢̂ 𝙖̂
á 𝚊́ 𝐚́ 𝑎́ 𝚊́ 𝒶́ 𝓪́ 𝔞́ 𝖆́ 𝕒́ 𝖺́ 𝗮́ 𝘢́ 𝙖́
å 𝚊̊ 𝐚̊ 𝑎̊ 𝚊̊ 𝒶̊ 𝓪̊ 𝔞̊ 𝖆̊ 𝕒̊ 𝖺̊ 𝗮̊ 𝘢̊ 𝙖̊
ă 𝚊̆ 𝐚̆ 𝑎̆ 𝚊̆ 𝒶̆ 𝓪̆ 𝔞̆ 𝖆̆ 𝕒̆ 𝖺̆ 𝗮̆ 𝘢̆ 𝙖̆
ǟ 𝚊̈̄ 𝐚̈̄ 𝑎̈̄ 𝚊̈̄ 𝒶̈̄ 𝓪̈̄ 𝔞̈̄ 𝖆̈̄ 𝕒̈̄ 𝖺̈̄ 𝗮̈̄ 𝘢̈̄ 𝙖̈̄
ã 𝚊̃ 𝐚̃ 𝑎̃ 𝚊̃ 𝒶̃ 𝓪̃ 𝔞̃ 𝖆̃ 𝕒̃ 𝖺̃ 𝗮̃ 𝘢̃ 𝙖̃
ā 𝚊̄ 𝐚̄ 𝑎̄ 𝚊̄ 𝒶̄ 𝓪̄ 𝔞̄ 𝖆̄ 𝕒̄ 𝖺̄ 𝗮̄ 𝘢̄ 𝙖̄
ȧ 𝚊̇ 𝐚̇ 𝑎̇ 𝚊̇ 𝒶̇ 𝓪̇ 𝔞̇ 𝖆̇ 𝕒̇ 𝖺̇ 𝗮̇ 𝘢̇ 𝙖̇
ȃ 𝚊̑ 𝐚̑ 𝑎̑ 𝚊̑ 𝒶̑ 𝓪̑ 𝔞̑ 𝖆̑ 𝕒̑ 𝖺̑ 𝗮̑ 𝘢̑ 𝙖̑
𝚋̣ 𝐛̣ 𝑏̣ 𝚋̣ 𝒷̣ 𝓫̣ 𝔟̣ 𝖇̣ 𝕓̣ 𝖻̣ 𝗯̣ 𝘣̣ 𝙗̣
č 𝚌̌ 𝐜̌ 𝑐̌ 𝚌̌ 𝒸̌ 𝓬̌ 𝔠̌ 𝖈̌ 𝕔̌ 𝖼̌ 𝗰̌ 𝘤̌ 𝙘̌
ć 𝚌́ 𝐜́ 𝑐́ 𝚌́ 𝒸́ 𝓬́ 𝔠́ 𝖈́ 𝕔́ 𝖼́ 𝗰́ 𝘤́ 𝙘́
ċ 𝚌̇ 𝐜̇ 𝑐̇ 𝚌̇ 𝒸̇ 𝓬̇ 𝔠̇ 𝖈̇ 𝕔̇ 𝖼̇ 𝗰̇ 𝘤̇ 𝙘̇
𝚌̧́ 𝐜̧́ 𝑐̧́ 𝚌̧́ 𝒸̧́ 𝓬̧́ 𝔠̧́ 𝖈̧́ 𝕔̧́ 𝖼̧́ 𝗰̧́ 𝘤̧́ 𝙘̧́
ç 𝚌̧ 𝐜̧ 𝑐̧ 𝚌̧ 𝒸̧ 𝓬̧ 𝔠̧ 𝖈̧ 𝕔̧ 𝖼̧ 𝗰̧ 𝘤̧ 𝙘̧
ċ 𝚌̇ 𝐜̇ 𝑐̇ 𝚌̇ 𝒸̇ 𝓬̇ 𝔠̇ 𝖈̇ 𝕔̇ 𝖼̇ 𝗰̇ 𝘤̇ 𝙘̇
ĉ 𝚌̂ 𝐜̂ 𝑐̂ 𝚌̂ 𝒸̂ 𝓬̂ 𝔠̂ 𝖈̂ 𝕔̂ 𝖼̂ 𝗰̂ 𝘤̂ 𝙘̂
è 𝚎̀ 𝐞̀ 𝑒̀ 𝚎̀ 𝓮̀ 𝓮̀ 𝔢̀ 𝖊̀ 𝕖̀ 𝖾̀ 𝗲̀ 𝘦̀ 𝙚̀
é 𝚎́ 𝐞́ 𝑒́ 𝚎́ 𝓮́ 𝓮́ 𝔢́ 𝖊́ 𝕖́ 𝖾́ 𝗲́ 𝘦́ 𝙚́
ē 𝚎̄ 𝐞̄ 𝑒̄ 𝚎̄ 𝓮̄ 𝓮̄ 𝔢̄ 𝖊̄ 𝕖̄ 𝖾̄ 𝗲̄ 𝘦̄ 𝙚̄
ĕ 𝚎̆ 𝐞̆ 𝑒̆ 𝚎̆ 𝓮̆ 𝓮̆ 𝔢̆ 𝖊̆ 𝕖̆ 𝖾̆ 𝗲̆ 𝘦̆ 𝙚̆
ë 𝚎̈ 𝐞̈ 𝑒̈ 𝚎̈ 𝓮̈ 𝓮̈ 𝔢̈ 𝖊̈ 𝕖̈ 𝖾̈ 𝗲̈ 𝘦̈ 𝙚̈
ě 𝚎̌ 𝐞̌ 𝑒̌ 𝚎̌ 𝓮̌ 𝓮̌ 𝔢̌ 𝖊̌ 𝕖̌ 𝖾̌ 𝗲̌ 𝘦̌ 𝙚̌
ê 𝚎̂ 𝐞̂ 𝑒̂ 𝚎̂ 𝓮̂ 𝓮̂ 𝔢̂ 𝖊̂ 𝕖̂ 𝖾̂ 𝗲̂ 𝘦̂ 𝙚̂
ę 𝚎̨ 𝐞̨ 𝑒̨ 𝚎̨ 𝓮̨ 𝓮̨ 𝔢̨ 𝖊̨ 𝕖̨ 𝖾̨ 𝗲̨ 𝘦̨ 𝙚̨
ȇ 𝚎̑ 𝐞̑ 𝑒̑ 𝚎̑ 𝓮̑ 𝓮̑ 𝔢̑ 𝖊̑ 𝕖̑ 𝖾̑ 𝗲̑ 𝘦̑ 𝙚̑
ȅ 𝚎̏ 𝐞̏ 𝑒̏ 𝚎̏ 𝓮̏ 𝓮̏ 𝔢̏ 𝖊̏ 𝕖̏ 𝖾̏ 𝗲̏ 𝘦̏ 𝙚̏
ğ 𝚐̆ 𝐠̆ 𝑔̆ 𝚐̆ 𝓰̆ 𝓰̆ 𝔤̆ 𝖌̆ 𝕘̆ 𝗀̆ 𝗴̆ 𝘨̆ 𝙜̆
ǧ 𝚐̌ 𝐠̌ 𝑔̌ 𝚐̌ 𝓰̌ 𝓰̌ 𝔤̌ 𝖌̌ 𝕘̌ 𝗀̌ 𝗴̌ 𝘨̌ 𝙜̌
ģ 𝚐̧ 𝐠̧ 𝑔̧ 𝚐̧ 𝓰̧ 𝓰̧ 𝔤̧ 𝖌̧ 𝕘̧ 𝗀̧ 𝗴̧ 𝘨̧ 𝙜̧
ġ 𝚐̇ 𝐠̇ 𝑔̇ 𝚐̇ 𝓰̇ 𝓰̇ 𝔤̇ 𝖌̇ 𝕘̇ 𝗀̇ 𝗴̇ 𝘨̇ 𝙜̇
𝚑̣ 𝐡̣ ℎ̣ 𝚑̣ 𝒽̣ 𝓱̣ 𝔥̣ 𝖍̣ 𝕙̣ 𝗁̣ 𝗵̣ 𝘩̣ 𝙝̣
ĩ 𝚒̃ 𝐢̃ 𝑖̃ 𝚒̃ 𝒾̃ 𝓲̃ 𝔦̃ 𝖎̃ 𝕚̃ 𝗂̃ 𝗶̃ 𝘪̃ 𝙞̃
î 𝚒̂ 𝐢̂ 𝑖̂ 𝚒̂ 𝒾̂ 𝓲̂ 𝔦̂ 𝖎̂ 𝕚̂ 𝗂̂ 𝗶̂ 𝘪̂ 𝙞̂
í 𝚒́ 𝐢́ 𝑖́ 𝚒́ 𝒾́ 𝓲́ 𝔦́ 𝖎́ 𝕚́ 𝗂́ 𝗶́ 𝘪́ 𝙞́
ì 𝚒̀ 𝐢̀ 𝑖̀ 𝚒̀ 𝒾̀ 𝓲̀ 𝔦̀ 𝖎̀ 𝕚̀ 𝗂̀ 𝗶̀ 𝘪̀ 𝙞̀
𝚔́ 𝐤́ 𝑘́ 𝚔́ 𝓀́ 𝓴́ 𝔨́ 𝖐́ 𝕜́ 𝗄́ 𝗸́ 𝘬́ 𝙠́
𝚔̣ 𝐤̣ 𝑘̣ 𝚔̣ 𝓀̣ 𝓴̣ 𝔨̣ 𝖐̣ 𝕜̣ 𝗄̣ 𝗸̣ 𝘬̣ 𝙠̣
ņ 𝚗̨ 𝐧̨ 𝑛̨ 𝚗̨ 𝓃̨ 𝓷̨ 𝔫̨ 𝖓̨ 𝕟̨ 𝗇̨ 𝗻̨ 𝘯̨ 𝙣̨
ń 𝚗́ 𝐧́ 𝑛́ 𝚗́ 𝓃́ 𝓷́ 𝔫́ 𝖓́ 𝕟́ 𝗇́ 𝗻́ 𝘯́ 𝙣́
ñ 𝚗 𝐧 𝑛 𝚗 𝓃 𝓷 𝔫 𝖓 𝕟 𝗇 𝗻 𝘯 𝙣
õ 𝚘̃ 𝐨̃ 𝑜̃ 𝚘̃ 𝓸̃ 𝓸̃ 𝔬̃ 𝖔̃ 𝕠̃ 𝗈̃ 𝗼̃ 𝘰̃ 𝙤̃
ö 𝚘̈ 𝐨̈ 𝑜̈ 𝚘̈ 𝓸̈ 𝓸̈ 𝔬̈ 𝖔̈ 𝕠̈ 𝗈̈ 𝗼̈ 𝘰̈ 𝙤̈
ō 𝚘̄ 𝐨̄ 𝑜̄ 𝚘̄ 𝓸̄ 𝓸̄ 𝔬̄ 𝖔̄ 𝕠̄ 𝗈̄ 𝗼̄ 𝘰̄ 𝙤̄
ô 𝚘̂ 𝐨̂ 𝑜̂ 𝚘̂ 𝓸̂ 𝓸̂ 𝔬̂ 𝖔̂ 𝕠̂ 𝗈̂ 𝗼̂ 𝘰̂ 𝙤̂
ó 𝚘́ 𝐨́ 𝑜́ 𝚘́ 𝓸́ 𝓸́ 𝔬́ 𝖔́ 𝕠́ 𝗈́ 𝗼́ 𝘰́ 𝙤́
ò 𝚘̀ 𝐨̀ 𝑜̀ 𝚘̀ 𝓸̀ 𝓸̀ 𝔬̀ 𝖔̀ 𝕠̀ 𝗈̀ 𝗼̀ 𝘰̀ 𝙤̀
ŕ 𝚛́ 𝐫́ 𝑟́ 𝚛́ 𝓇́ 𝓻́ 𝔯́ 𝖗́ 𝕣́ 𝗋́ 𝗿́ 𝘳́ 𝙧́
ş 𝚜̧ 𝐬̧ 𝑠̧ 𝚜̧ 𝓈̧ 𝓼̧ 𝔰̧ 𝖘̧ 𝕤̧ 𝗌̧ 𝘀̧ 𝘴̧ 𝙨̧
ș 𝚜̦ 𝐬̦ 𝑠̦ 𝚜̦ 𝓈̦ 𝓼̦ 𝔰̦ 𝖘̦ 𝕤̦ 𝗌̦ 𝘀̦ 𝘴̦ 𝙨̦
𝚜̣̇ 𝐬̣̇ 𝑠̣̇ 𝚜̣̇ 𝓈̣̇ 𝓼̣̇ 𝔰̣̇ 𝖘̣̇ 𝕤̣̇ 𝗌̣̇ 𝘀̣̇ 𝘴̣̇ 𝙨̣̇
š 𝚜̌ 𝐬̌ 𝑠̌ 𝚜̌ 𝓈̌ 𝓼̌ 𝔰̌ 𝖘̌ 𝕤̌ 𝗌̌ 𝘀̌ 𝘴̌ 𝙨̌
ś 𝚜́ 𝐬́ 𝑠́ 𝚜́ 𝓈́ 𝓼́ 𝔰́ 𝖘́ 𝕤́ 𝗌́ 𝘀́ 𝘴́ 𝙨́
ü 𝚞̈ 𝐮̈ 𝑢̈ 𝚞̈ 𝓊̈ 𝓾̈ 𝔲̈ 𝖚̈ 𝕦̈ 𝗎̈ 𝘂̈ 𝘶̈ 𝙪̈
ù 𝚞̀ 𝐮̀ 𝑢̀ 𝚞̀ 𝓊̀ 𝓾̀ 𝔲̀ 𝖚̀ 𝕦̀ 𝗎̀ 𝘂̀ 𝘶̀ 𝙪̀
ú 𝚞́ 𝐮́ 𝑢́ 𝚞́ 𝓊́ 𝓾́ 𝔲́ 𝖚́ 𝕦́ 𝗎́ 𝘂́ 𝘶́ 𝙪́
û 𝚞̂ 𝐮̂ 𝑢̂ 𝚞̂ 𝓊̂ 𝓾̂ 𝔲̂ 𝖚̂ 𝕦̂ 𝗎̂ 𝘂̂ 𝘶̂ 𝙪̂
ŭ 𝚞̆ 𝐮̆ 𝑢̆ 𝚞̆ 𝓊̆ 𝓾̆ 𝔲̆ 𝖚̆ 𝕦̆ 𝗎̆ 𝘂̆ 𝘶̆ 𝙪̆
ȕ 𝚞̏ 𝐮̏ 𝑢̏ 𝚞̏ 𝓊̏ 𝓾̏ 𝔲̏ 𝖚̏ 𝕦̏ 𝗎̏ 𝘂̏ 𝘶̏ 𝙪̏
ȗ 𝚞̑ 𝐮̑ 𝑢̑ 𝚞̑ 𝓊̑ 𝓾̑ 𝔲̑ 𝖚̑ 𝕦̑ 𝗎̑ 𝘂̑ 𝘶̑ 𝙪̑
ů 𝚞̊ 𝐮̊ 𝑢̊ 𝚞̊ 𝓊̊ 𝓾̊ 𝔲̊ 𝖚̊ 𝕦̊ 𝗎̊ 𝘂̊ 𝘶̊ 𝙪̊
ū 𝚞̄ 𝐮̄ 𝑢̄ 𝚞̄ 𝓊̄ 𝓾̄ 𝔲̄ 𝖚̄ 𝕦̄ 𝗎̄ 𝘂̄ 𝘶̄ 𝙪̄
𝚠̀ 𝐰̀ 𝑤̀ 𝚠̀ 𝓌̀ 𝔀̀ 𝔴̀ 𝖜̀ 𝕨̀ 𝗐̀ 𝘄̀ 𝘸̀ 𝙬̀
𝚠́ 𝐰́ 𝑤́ 𝚠́ 𝓌́ 𝔀́ 𝔴́ 𝖜́ 𝕨́ 𝗐́ 𝘄́ 𝘸́ 𝙬́
ø 𝚘̷ 𝐨̷ 𝑜̷ 𝚘̷ 𝓸̷ 𝓸̷ 𝔬̷ 𝖔̷ 𝕠̷ 𝗈̷ 𝗼̷ 𝘰̷ 𝙤̷

All capital letters are turned into their latin root. Diacritical marks looks silly on most of them. Only in rare cases mimicking a capital letter ends up in a readable entity.
toUnicodeVariant('üničode', 'bold italic') //𝒖̈𝒏𝒊𝒄̌𝒐𝒅𝒆
toUnicodeVariant('ÜNIĈODE', 'bold italic') //𝑼𝑵𝑰𝑪𝑶𝑫𝑬

🔎 Overall support of numbers, special chars, small letters and diacritics
Numbers Small letters Special chars Diacritics
monospace 𝟷 𝚊 𝚌̧ 𝚌̶̧
bold 𝟏 𝐚 𝐜̧ 𝐜̶̧
italic - 𝑎 𝑐̧ 𝑐̶̧
bold italic - 𝒂 𝒄̧ 𝒄̶̧
script - 𝒶 𝒸̧ 𝒸̶̧
bold script - 𝓪 𝓬̧ 𝓬̶̧
gothic - 𝔞 𝔠̧ 𝔠̶̧
gothic bold - 𝖆 𝖈̧ 𝖈̶̧
doublestruck 𝟙 𝕒 𝕔̧ 𝕔̶̧
sans 𝟣 𝖺 𝖼̧ 𝖼̶̧
bold sans 𝟭 𝗮 𝗰̧ 𝗰̶̧
italic sans - 𝘢 𝘤̧ 𝘤̶̧
bold italic sans - 𝙖 𝙘̧ 𝙘̶̧
parenthesis - -
squared - - - -
squared negative - - - -
circled - -
circled negative - - - -
fullwidth - -
flags - - - -
numbers dot - - -
numbers comma 🄂 - - -
numbers double circled - - -

Additions, limitations

Besides the limitations you can see in the various compatibility tables above, some variants offers extra unique features - other variants are reduced to one single feature alone.

  • 🄰 squared, qSupports a mixed collection of terms and abbreviations, rendered as one unicode entity: SOS, WC, 4K etc
    🅊 🅋 🅌 🅍 🅎 🅏 🆑 🆒 🆓 🆔 🆕 🆖 🆗 🆘 🆙 🆚 🆛 🆜 🆝 🆞 🆟 🆠 🆡 🆢 🆣 🆤 🄳
  • 🅰 squared negative, qnA,B,O are in some readers rendered as blood type A,B,O. Support a few abbreviations, rendered as one unicode entity: IC, PA, SA, AB, WC
    🆋 🆌 🆍 🆎 🆏
  • 🄐 paranthesis, pNo support of 0, but support numbers 10-20
    ⑽ ⑾ ⑿ ⒀ ⒁ ⒂ ⒃ ⒄ ⒅ ⒆ ⒇
  • Ⓐ circled, oSupport numbers 10-20
    ⑩ ⑪ ⑫ ⑬ ⑭ ⑮ ⑯ ⑰ ⑱ ⑲ ⑳
  • 🅐 circled negative, onLack support of small numbers 1-9 (fallbacks to circled numbers), but support numbers 11-20
    ⓫ ⓬ ⓭ ⓮ ⓯ ⓰ ⓱ ⓲ ⓳ ⓴
  • A fullwidth, wSupport basic symbols like @ and %; support a few extended ASCII codes as well
    ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ \ [ ] ^ _ ` { | } ~ ⦅ ⦆ ¢ £ ¦ ¥ ₩ ー ー 、 ・  ̄ ¬
  • 🄀 numbers dot, ndOnly numbers, additional support of 10-20. Fallbacks to monospace. Does not support any of the space-combinings
    🄀 ⒈ ⒉ ⒊ ⒋ ⒌ ⒍ ⒎ ⒏ ⒐ ⒒ ⒓ ⒔ ⒕ ⒖ ⒗ ⒘ ⒙ ⒚ ⒛
  • 🄁 numbers comma, ncOnly numbers, supports 0-9 only. Fallbacks to monospace
    🄁 🄂 🄃 🄄 🄅 🄆 🄇 🄈 🄉 🄊
  • ⓵ numbers double circled, ndcOnly numbers, does not support 0, supports 10. Fallbacks to monospace
    ⓵ ⓶ ⓷ ⓸ ⓹ ⓺ ⓻ ⓼ ⓽ ⓾
  • Ⅻ roman, rRoman numerals only, supports both small and capital letters. Are converted to best fit of the following numeral sequenzes
    Ⅰ Ⅱ Ⅲ Ⅳ Ⅴ Ⅵ Ⅶ Ⅷ Ⅸ Ⅹ Ⅺ Ⅻ Ⅼ Ⅽ Ⅾ

Ⅻ roman, continued

If you pass a number (integer) instead of a string, that number will be romanized automatically before converting to unicode

 toUnicodeVariant(2023, 'roman') //ⅯⅯⅩⅩⅢ

flags, f

az-AZ only. Based on the highly special regional indicator symbols (see references below, U1F100.pdf). Using that you'll need to pass a string with whitespace between each character (otherwise expect weird output, there is no fallback to monospace) :

toUnicodeVariant('U N I C O D E', 'f') //🇺 🇳 🇮 🇨 🇴 🇩 🇪

However, if you pass a string that contain a country code, or even the name of some international organization, many readers will render the corresponding flag instead :

toUnicodeVariant('DK EU UN', 'flags') //🇩🇰 🇪🇺 🇺🇳

Reset a unicoded' string

Use String.normalize()

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize

'𝖆𝖇𝖈𝖉𝖊𝖋𝖌𝖍𝖎𝖏𝖐𝖑𝖒𝖓𝖔𝖕𝖖𝖗𝖘𝖙𝖚𝖛𝖜𝖝𝖞𝖟'.normalize('NFKC') //or NFKD

returns abcdefghijklmnopqrstuvwxyz

Test

Browser: test/browser.html Node: test$ node node.js

These tests show all variants and their coverage az-AZ-09, along with flag combinations For reference, in Chrome (Ubuntu 20.04, 112.x) variants looks like this :

-- Or you can review a sample output, test/result-sample.html.txt. Try it out in different browsers - there are significant difference in coverage.

References

https://www.unicode.org/charts/PDF/UFF00.pdf
https://www.unicode.org/charts/PDF/U1F100.pdf
https://www.unicode.org/charts/PDF/U1D400.pdf
https://www.unicode.org/charts/PDF/U2150.pdf
https://www.unicode.org/charts/PDF/U2460.pdf
https://www.unicode.org/charts//PDF/Unicode-3.2/U32-2000.pdf
https://www.unicode.org/charts//PDF/Unicode-4.0/U40-0300.pdf

Playground

For now, visit https://detfrieord.dk/tekst-til-unicode (in danish, sorry)

Package Sidebar

Install

npm i string-to-unicode-variant

Weekly Downloads

48

Version

1.0.9

License

MIT

Unpacked Size

184 kB

Total Files

9

Last publish

Collaborators

  • degola