=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/read.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- src/usr.bin/mandoc/read.c 2011/11/05 16:02:18 1.5 +++ src/usr.bin/mandoc/read.c 2012/02/26 21:01:43 1.6 @@ -1,4 +1,4 @@ -/* $Id: read.c,v 1.5 2011/11/05 16:02:18 schwarze Exp $ */ +/* $Id: read.c,v 1.6 2012/02/26 21:01:43 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2011 Ingo Schwarze @@ -315,9 +315,9 @@ * 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]; @@ -325,8 +325,11 @@ 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; }