Quick Tip #12: Unicode Helper Apps

Perl 6 uses fancy Unicode characters to do some of its work, but those don’t show up on most keyboards. I like the Mac program UnicodeChecker. I can search by name, code point, or I can paste a character. I find the one that I want, copy it, and paste it into source. The Windows program BabelStine looks similar. Leave me suggestions if you know something for your distro.

UnicodeChecker

Or, you can write your own program. Here’s one that takes codepoints and prints their characters (assuming that your terminal is already set up for UTF-8):

$ perl6 -e 'for @*ARGS { say chr(:16($_)) }' 2150 2153
⅐
⅓

The :16() interprets its string argument as base 16. You can convert any base between 2 and 36 that way.

I can have some command-line aliases:

alias u2char='perl6 -e "for @*ARGS { say chr(:16(\$_)) }"'

One comment

  1. I’ve built a Unicode search tool at http://www.mclean.net.nz/ucf/ called the “Unicode Character Finder”.

    You can use it to search the character descriptions; paste in a character to find more information about it; explore related characters via the code chart; save characters in a “scratchpad” for easy recall later; compose and decompose characters between normal forms; share links to specific characters or search results.

    Use the “Help” tab to find out how to drive it and to find links to other Unicode tools. Follow the github link to fork it and make it even better.

    The Unicode Character Finder is a Javascript app that runs from static files (no AJAX backend) so you can run your own copy locally. It uses a data file generated from the Unicode database (currently version 9.0.0) using a Perl(5) script. Enjoy 🙂

Leave a Reply to Grant McLean Cancel reply

Your email address will not be published. Required fields are marked *