Emacs: Latin to Braille ⠎⠕⠍⠑

By Xah Lee. Date: . Last updated: .

Here's a command that convert Latin alphabet characters to Braille characters.

⠎⠕⠍⠑⠞⠓⠊⠝⠛ ⠊⠝ ⠞⠓⠑ ⠺⠁⠞⠑⠗

For JavaScript version, see Unicode Braille ⠮

(defun xah-convert-latin-to-braille (@begin @end @to-latin-p)
  "Replace English letters to Unicode braille characters.

When called interactively, work on current line or text selection.
If `universal-argument' is called first, reverse direction.
Note: original letter case are not preserved. B may become b.

URL `http://ergoemacs.org/misc/elisp_latin_to_braille.html'
Version 2019-09-17 2021-07-31"
  (interactive
   (if (use-region-p)
       (list (region-beginning) (region-end) current-prefix-arg )
     (list (line-beginning-position) (line-end-position) current-prefix-arg )))
  (let ( $toBrailleMap $useMap )
    (setq $toBrailleMap [ ["1" "⠼⠁"] ["2" "⠼⠃"] ["3" "⠼⠉"] ["4" "⠼⠙"] ["5" "⠼⠑"] ["6" "⠼⠋"] ["7" "⠼⠛"] ["8" "⠼⠓"] ["9" "⠼⠊"] ["0" "⠼⠚"]
           ["," "⠂"] [";" "⠆"] [":" "⠒"] ["." "⠲"] ["?" "⠦"] ["!" "⠖"] ["‘" "⠄"] ["“" "⠄⠶"] ["“" "⠘⠦"] ["”" "⠘⠴"] ["‘" "⠄⠦"] ["’" "⠄⠴"] ["(" "⠐⠣"] [")" "⠐⠜"] ["/" "⠸⠌"] ["\\","⠸⠡"] ["-" "⠤"] ["–" "⠠⠤"] ["—" "⠐⠠⠤"] ["a" "⠁"] ["b" "⠃"] ["c" "⠉"] ["d" "⠙"] ["e" "⠑"] ["f" "⠋"] ["g" "⠛"] ["h" "⠓"] ["i" "⠊"] ["j" "⠚"] ["k" "⠅"] ["l" "⠇"] ["m" "⠍"] ["n" "⠝"] ["o" "⠕"] ["p" "⠏"] ["q" "⠟"] ["r" "⠗"] ["s" "⠎"] ["t" "⠞"] ["u" "⠥"] ["v" "⠧"] ["w" "⠺"] ["x" "⠭"] ["y" "⠽"] ["z" "⠵"] ] )
    (setq $useMap (if @to-latin-p (mapcar (lambda ($x) (vector (aref $x 1) (aref $x 0))) $toBrailleMap) $toBrailleMap))
    (save-excursion
      (save-restriction
        (narrow-to-region @begin @end)
        (let ( (case-fold-search t))
          (mapc
           (lambda ($x)
             (goto-char (point-min))
             (while (search-forward (elt $x 0) nil t)
               (replace-match (elt $x 1) "FIXEDCASE" "LITERAL")))
           $useMap))))))

Emacs Lisp, Convert English to Other