How to get the character matching the Unicode character name?

I am developing a translator of braille to text , and a nice feature showing output in Unicode characters of braille (say, type of Unicode braille generator).

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

Is there any easy way to get a Unicode character in Javascript from its Unicode name?

My second attempt will have a math * ing * value with Unicode values, but I think creating names is pretty simple.

Thank you in advance:)

+4
source share
2 answers

JavaScript, unlike some other languages, has no direct way to get a character from its Unicode name. In my full Unicode input utility , so I used the brute force method of using a Unicode character database as a text block and parsing it. You might find more effective and efficient tools, but if you only need some specific character collections, as in the question, it is better to use ad hoc. In this case, you don’t even need Unicode names as such; they will be just an intermediate step from dot patterns to symbols.

Clause 15.11 of the Unicode standard, chapter 15 , describes the principles for distributing Braille characters.

+2
source

Very interesting. In my application. I use the DB as you described, and then use Javascript and an html canvas object to dynamically build the braille. This has the added benefit that I can create custom ARIA tags if necessary. I say this because the ASCII Braille and Unicode are not readable by multiple, if not all Screen Readers. I know that VoiceOver on iOS and Mac will not read it. Something I'm working on is a way to get JS to read ASCII and Unicode BRL fields and create ARIA tags so that the blind user really knows what is happening on the web page.

0
source

Source: https://habr.com/ru/post/1487994/


All Articles