* mdocml: Don't silently skip non-ASCII characters, but replace them with
@ 2012-02-05 16:46 joerg
0 siblings, 0 replies; only message in thread
From: joerg @ 2012-02-05 16:46 UTC (permalink / raw)
To: source
Log Message:
-----------
Don't silently skip non-ASCII characters, but replace them with ``?''.
This is less likely to break the syntax of macros.
Modified Files:
--------------
mdocml:
read.c
Revision Data
-------------
Index: read.c
===================================================================
RCS file: /home/joerg/cvsroot/mdocml/read.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -Lread.c -Lread.c -u -p -r1.26 -r1.27
--- read.c
+++ read.c
@@ -325,9 +325,9 @@ mparse_buf_r(struct mparse *curp, struct
* Warn about bogus characters. If you're using
* non-ASCII encoding, you're screwing your
* readers. Since I'd rather this not happen,
- * I'll be helpful and drop these characters so
- * we don't display gibberish. Note to manual
- * writers: use special characters.
+ * I'll be helpful and replace these characters
+ * with "?", so we don't display gibberish.
+ * Note to manual writers: use special characters.
*/
c = (unsigned char) blk.buf[i];
@@ -335,8 +335,11 @@ mparse_buf_r(struct mparse *curp, struct
if ( ! (isascii(c) &&
(isgraph(c) || isblank(c)))) {
mandoc_msg(MANDOCERR_BADCHAR, curp,
- curp->line, pos, "ignoring byte");
+ curp->line, pos, NULL);
i++;
+ if (pos >= (int)ln.sz)
+ resize_buf(&ln, 256);
+ ln.buf[pos++] = '?';
continue;
}
--
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:[~2012-02-05 16:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-05 16:46 mdocml: Don't silently skip non-ASCII characters, but replace them with joerg
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).