source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Flip on printing `?' at Unicode codepoints in -Tascii, -Tpdf,
@ 2011-05-17 11:55 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2011-05-17 11:55 UTC (permalink / raw)
  To: source

Log Message:
-----------
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.

Modified Files:
--------------
    mdocml:
        term.c

Revision Data
-------------
Index: term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term.c,v
retrieving revision 1.191
retrieving revision 1.192
diff -Lterm.c -Lterm.c -u -p -r1.191 -r1.192
--- term.c
+++ term.c
@@ -451,6 +451,9 @@ term_word(struct termp *p, const char *w
 			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
 		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
 			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;
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-05-17 11:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-17 11:55 mdocml: Flip on printing `?' at Unicode codepoints in -Tascii, -Tpdf, kristaps

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).