Issues with Char and printing ansi color codes to the terminal with Motoko

Technically, a “character” is a single Unicode code point. The escape sequence "\033[32m" consists of 5 code points, so it isn’t a single character in the sense of Unicode, even if it is printed as one by ANSI terminals interpreting it specially.

This is not specific to Motoko, no other programming language that has a character type will accept that string as a character value. You can only store it as a text string.

3 Likes