๐๐๐๐ค ๐จ๐๐๐ฃ๐ ๐ฅ๐๐ฉ๐ฅ ๐จ๐๐ค ๐๐ ๐๐ค๐ฅ๐ฃ๐ฆ๐๐ฅ๐๐ ๐จ๐๐ฅ๐ ๐ฅ๐๐ ๐ฆ๐ฅ๐๐๐๐ฅ๐ช ๐๐๐๐ฅ๐๐ ๐๐๐ ๐๐ ๐ฅ๐๐ ๐ฅ๐๐ฅ๐๐. ๐ข๐ธ ๐๐ช๐ผ ๐ฝ๐ฑ๐ฒ๐ผ ๐ฝ๐ฎ๐๐ฝ ๐ฑ๐ฎ๐ป๐ฎ. ๐๐ป๐ฑ ๐ฎ๐น๐๐ผ ๐๐ต๐ถ๐. ๐ฌ๐๐๐๐๐๐๐๐๐๐, ๐๐๐๐.
Can you read those? There’s a good chance you can! If you can’t (like if they all show up as hollow boxes) it’s because the font you’re reading this post in doesn’t support those kinds of characters, which are from the math symbols section of the Unicode character set.
It’s a command-line version of a web Unicode text converter, of the sort found at the other end of this link. It’s written in Python, and the source is at the end of this post. I saved it to a file named “fancypants” and put it in my home directory’s bin directory (which you’ll probably have to make first), where many Linux distributions are configured to look for things to execute if you type their names at the command prompt. (Yes, all of this assumes you’re running Linux. It’s not just for supergeeks anymore! If you’re running Windows you’ll have some adjustments to make, including figuring out how to add the script’s home to your path. It should work on Macs, although I don’t know if it’ll look in your home’s bin either.)
Oh, you will have to run a chmod +x fancypants on it. And the script as written assumes Python is at /usr/bin/python, where most distros will put it.
The script expects to be executed in the form:
fancypants [style] [text to convert]
The text should probably be in quotes if there’s any spaces in it, as should the style just in case. So to produce the first text mentioned at the start of the post, I entered:
fancypants "=" "This weird text was constructed with the utility mentioned in the title."
Usable style specifiers are “=” for double-stroke, “/” for script, “!” for a boldface kind of thing, “f” for the medieval script-looking fractur, and a few others that you can pretty easily see in the source code below. In fact each specifier has some synonyms if the single-character versions are too obscure for you to remember. And hey, if you don’t like the names I gave them you can use your own! The moment you paste it into a text file, this all becomes yours to do with as you please. Think of it as the blog version of a type-in program from an 80s computer magazine.
As a bonus, the names “r”, “rot” or “rot13” will perform a ROT13 code on the letters, useful for encoding spoiler text that readers can decode at ROT13.com. There are utilities that you can use to send the generated text directly to the clipboard, for pasting wherever you want, but since those differ if you’re using X.org or Wayland for your display manager (or, sure, Windows or Mac) I’ll leave those for you to figure out.
And if you can’t read the characters above, then I’m sorry that you’re missing out on the fun. It’s all pretty whimsical really, it’s not some huge thing that you’re missing. Come back tomorrow, I’m sure we’ll have a post about Mario or somesuch.
#!/usr/bin/python
import sys
base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()-_=+[]{};':\",./<>?~"
equals = "๐ธ๐นโ๐ป๐ผ๐ฝ๐พโ๐๐๐๐๐โ๐โโโ๐๐๐๐๐๐๐โค๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ๐๐๐๐๐๐๐๐ ๐ก๐!@#$%^&*()-_=+[]{};':\",./<>?~"
script = "๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐๐๐๐1234567890!@#$%^&*()-_=+[]{};':\",./<>?~"
bold = "๐๐๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐๐๐๐๐๐๐๐๐๐!@#$%^&*()-_=+[]{};':\",./<>?~"
bolditalic = "๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐๐๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐1234567890!@#$%^&*()-_=+[]{};':\",./<>?~"
monospace = "๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐๐๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐ ๐ก๐ข๐ฃ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐ถ!@#$%^&*()-_=+[]{};':\",./<>?~"
block = "๐๐๐๐๐๐๐๐๐๐๐๐๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐๐๐๐๐๐ ๐๐๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ฌ!@#$%^&*()-_=+[]{};':\",./<>?~"
fraktur = "๐ฌ๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐๐๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐1234567890!@#$%^&*()-_=+[]{};':\",./<>?~"
rot = "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm1234567890!@#$%^&*()-_=+[]{};':\",./<>?~"
tilde = len(equals)-1
def convert(convertchar, intext):
outlist = []
match convertchar:
case "=" | "equal" | "equals":
clist = equals
case "/" | "slant" | "script":
clist = script
case "!" | "bold":
clist = bold
case "!/" | "bolditalic" | "boldital":
clist = bolditalic
case "m" | "mono" | "monospace":
clist = monospace
case "b" | "block" | "mathbold":
clist = block
case "f" | "fraktur":
clist = fraktur
case "r" | "rot" | "rot13":
clist = rot
case _:
raise ValueError("Unknown charset " + convertchar)
return intext
for char in intext:
try:
index = base.index(char)
except:
outlist.append(char)
continue
outchr = clist[index]
if outchr != "~":
outlist.append(outchr)
else:
outlist.append(base[index])
return "".join(outlist)
if __name__ == "__main__":
convertchar = sys.argv[1]
intext = sys.argv[2]
print(convert(convertchar, intext))