nowox
nowox

Reputation: 29116

ASCII tables using unicode chars

Nowadays most of the terminals we use are able to display unicode symbols. Thus, this box:

+--------------+
| Hello World! |
+--------------+

can easily be rewritten like this using unicode chars:

┌──────────────┐
│ Hello World! │
└──────────────┘

Several command-line tools such as boxes or the Perl CPAN module Text::ASCIITable can draw regular ASCII boxes without unicode chars.

My question is for which reason should I avoid using unicode chars (at least after checking if $LANG contains utf8)?

Disclaimer: I'm asking for a pragmatic analysis of the problem not any personal opinion cuz some people may think this question is a primarily opinion-based question.

Upvotes: 0

Views: 190

Answers (1)

Jukka K. Korpela
Jukka K. Korpela

Reputation: 201768

The main reason why using “Unicode characters” in the sense implied in the question (i.e. characters outside the ASCII range) is that not all fonts support them. Secondarily, not all programs support them, but this point is losing significance.

When you render characters in a font that does not contain them, they are typically replaced by small rectangles or similar indicators of missing glyphs.

If you can ensure that your software will be used only in environments where the font used to display you character graphics will contain all the characters needed, in acceptable shape, there should be no reason to avoid using non-ASCII characters.

However, the details of rendering will depend on the font used and on the parameters of rendering. For example, box drawing characters do not always join the intended way. On the other hand, even when they don’t, the result is usually better than using ASCII only.

Upvotes: 1

Related Questions