Unicode Braille Characters

Unicode braille characters are made by OR-ing the blank braille symbol (0x2800) with a byte that defines the raised dots. A braille symbol has 8 different dots, thus it fits perfectly in a byte.

The dot order:

0 3
1 4
2 5
6 7

For example, the unicode code point for “⢎” is 0x2800 | 2 | 4 | 8 | 128 = 0x288E, because the byte that defines the raised dots, in binary notation, equals:

76543210
--------
10001110

Programs that use unicode braille characters in funny ways: tplot, brclock.

Sample code:

#include <locale.h>
#include <stdint.h>
#include <stdio.h>

#define BRAILLE_EMPTY 0x2800
#define URANDOM "/dev/urandom"

/* read a random byte from /dev/urandom */
uint8_t get_rnd_byte() {
	FILE *fin = fopen(URANDOM, "rb");
	uint8_t byte;

	fread(&byte, 1, 1, fin);
	fclose(fin);

	return byte;
}

int main() {
	/* set locale according to environment variables */
	setlocale(LC_ALL, "");

	uint8_t dots = get_rnd_byte() % (1 << 8);
	printf("%lc\n", BRAILLE_EMPTY | dots);

	return 0;
}