Skip to main content
7 events
when toggle format what by license comment
Jun 2, 2021 at 13:06 comment added MRule "An application running in a terminal has no way to find out from the terminal what the glyphs that the terminal has drawn look like (or even if they are substitute/placeholder characters)"" : This is not quite true, at least on linux systems. It is sometimes possible to figure out what font a given terminal is using by reading configuration variables, and then detect supported glyphs by examining the corresponding font file. The setfont command can also be used to output a map from unicode-code-points to terminal-font-code points, which provide clues about which glyphs can be rendered.
May 25, 2016 at 19:38 comment added Celada @egmont is quite right to recommend not using the trick I proposed in general. It's from a login script I wrote in 2003 whose job was to autodetect the UTF-8 support of the terminal and set the locale appropriately. A normal app should just assume the locale is set right without testing. I agree that if you need this kind of trick in 2016 you have a sorry system.
May 24, 2016 at 12:10 comment added egmont As Celada correctly points out, there's no way to detect if a glyph is displayed correctly. Although the answer shows you correctly how to detect if UTF-8 is supported. I recommend you not to do this. Any emulator not supporting UTF-8 should've been ditched a long time ago. If the terminal's behavior doesn't match the locale's charset, all the applications will fall apart big time. Imagine if every app repeated this check, and then... then what? It's not feasible. Apps should assume that the underlying system is set up correctly. If you really care, I recommend you to add a FAQ entry.
May 23, 2016 at 22:58 comment added Gilles 'SO- stop being evil' Character set detection by width packaged in a script
May 23, 2016 at 20:46 comment added Thomas Dickey That's only half the problem: the terminal may "know" a width for a character, but not display it due to font limitations. Also, the width may not be what you expect.
May 23, 2016 at 19:56 vote accept kris
May 23, 2016 at 19:24 history answered Celada CC BY-SA 3.0