diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-10-26 18:07:28 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-10-26 18:07:28 +0000 |
commit | dead96d50530a782ee738938c2c911a44e97bede (patch) | |
tree | 6df7784f41fd9f09ae92463e04d382575784394a /term_ascii.c | |
parent | 5faa62e2445541401f9bee1667d1cd2b2e443e53 (diff) | |
download | mandoc-dead96d50530a782ee738938c2c911a44e97bede.tar.gz mandoc-dead96d50530a782ee738938c2c911a44e97bede.tar.zst mandoc-dead96d50530a782ee738938c2c911a44e97bede.zip |
In -Tascii mode, provide approximations even for some Unicode escape
sequences above codepoint 512 by doing a reverse lookup in the
existing mandoc_char(7) character table.
Again, groff isn't smart enough to do this and silently discards such
escape sequences without printing anything.
Diffstat (limited to 'term_ascii.c')
-rw-r--r-- | term_ascii.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/term_ascii.c b/term_ascii.c index 64f9f686..1b3040a0 100644 --- a/term_ascii.c +++ b/term_ascii.c @@ -1,4 +1,4 @@ -/* $Id: term_ascii.c,v 1.34 2014/10/26 17:12:03 schwarze Exp $ */ +/* $Id: term_ascii.c,v 1.35 2014/10/26 18:07:28 schwarze Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -236,9 +236,11 @@ ascii_uc2str(int uc) "j", "DZ", "D", "dz", "G", "g", "HV", "W", "N", "n", "A", "a", "AE", "ae", "O", "o"}; - if (uc < 0 || (size_t)uc >= sizeof(tab)/sizeof(tab[0])) + if (uc < 0) return("<?>"); - return(tab[uc]); + if ((size_t)uc < sizeof(tab)/sizeof(tab[0])) + return(tab[uc]); + return(mchars_uc2str(uc)); } static size_t |