aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-05-17 11:55:08 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-05-17 11:55:08 +0000
commitd72b93d8133ec9ce52e458f06774fdf6db5b77cc (patch)
tree27e71b927c402a03099d152818b5dc8c379b80e3 /term.c
parent1ee1eeda195d12cccd87b8fdfca9e982035a89e7 (diff)
downloadmandoc-d72b93d8133ec9ce52e458f06774fdf6db5b77cc.tar.gz
mandoc-d72b93d8133ec9ce52e458f06774fdf6db5b77cc.tar.zst
mandoc-d72b93d8133ec9ce52e458f06774fdf6db5b77cc.zip
Flip on printing `?' at Unicode codepoints in -Tascii, -Tpdf, and -Tps.
The reasoning behind printing SOMETHING at a Unicode codepoint is because the input is not "wrong" (we suppress printing of "wrong" things). It's just that ASCII can't handle it.
Diffstat (limited to 'term.c')
-rw-r--r--term.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/term.c b/term.c
index 0ea561cb..bfedefb0 100644
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.191 2011/05/15 22:29:50 kristaps Exp $ */
+/* $Id: term.c,v 1.192 2011/05/17 11:55:08 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -451,6 +451,9 @@ term_word(struct termp *p, const char *word)
break;
switch (esc) {
+ case (ESCAPE_UNICODE):
+ encode(p, "?", 1);
+ break;
case (ESCAPE_NUMBERED):
if ('\0' != (c = mchars_num2char(seq, sz)))
encode(p, &c, 1);
@@ -584,6 +587,7 @@ term_strlen(const struct termp *p, const char *cp)
for (i = 0; i < rsz; i++)
sz += (*p->width)(p, *cp++);
+ c = 0;
switch (*cp) {
case ('\\'):
cp++;
@@ -591,8 +595,12 @@ term_strlen(const struct termp *p, const char *cp)
switch (mandoc_escape(&cp, &seq, &ssz)) {
case (ESCAPE_ERROR):
return(sz);
+ case (ESCAPE_UNICODE):
+ c = '?';
+ /* FALLTHROUGH */
case (ESCAPE_NUMBERED):
- c = mchars_num2char(seq, ssz);
+ if ('\0' != c)
+ c = mchars_num2char(seq, ssz);
if ('\0' != c)
sz += (*p->width)(p, c);
break;