javascriptunicodedata-conversionbraille

How to get the character corresponding to a Unicode character name?


I'm developing a Braille-to-text translator, and a nice feature to have is showing an output in Unicode's Braille patterns characters (say, kind of a Unicode Braille generator).

Since I know the dots that are "enabled" in each cell ("Braille character"), it would be trivial to construct the Unicode name of the character I need (they are of the form of BRAILLE PATTERN DOTS-123456 if they are all enabled, or BRAILLE PATTERN DOTS-14 if only dots 1 and 4 are enabled.

Is there any simple method to get a Unicode character in Javascript from its Unicode name?

My second try will be math*ing* with the Unicode values, but I think constructing the names is pretty much straightforward.

Thanks in advance :)


Solution

  • JavaScript, unlike some other languages, does not have any direct way of getting a character from its Unicode name. In my full Unicode input utility, I have therefore used the brute force method of using the Unicode character data base as a text block and parsing it. You might find some better, more efficient and more maintainable tools, but if you need just some specific collections of characters as in the question, an ad hoc approach is better. In this case, you don’t even need the Unicode names as such; they would be just an intermediate step from dot patterns to characters.

    Clause 15.11 in the Unicode Standard, chapter 15, describes the allocation principles for Braille symbols.