From: Ingo Schwarze <schwarze@usta.de>
To: discuss@mdocml.bsd.lv
Subject: Re: Discarding non-ASCII input
Date: Sun, 5 Feb 2012 11:17:44 +0100 [thread overview]
Message-ID: <20120205101744.GA15816@iris.usta.de> (raw)
In-Reply-To: <20120205004542.GA17831@britannica.bec.de>
Hi Joerg,
Joerg Sonnenberger wrote on Sun, Feb 05, 2012 at 01:45:42AM +0100:
> at the moment we are discarding any non-ASCII characters. This turns a
> bunch of syntactically documents into complete garbage, e.g. by removing
> the arguments for .SH macros. I think it is more reasonable to replace
> them with "safe" garbage like iconv on most platforms does.
>
> What do you think of the attached patch?
I think i like the idea.
You might also wish to replace the "ignoring byte" by NULL
when changing this.
Thanks,
Ingo
> Index: read.c
> ===================================================================
> RCS file: /home/joerg/cvsroot/mdocml/read.c,v
> retrieving revision 1.26
> diff -u -p -r1.26 read.c
> --- read.c 7 Nov 2011 01:24:40 -0000 1.26
> +++ read.c 5 Feb 2012 00:31:33 -0000
> @@ -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];
> @@ -337,6 +337,9 @@ mparse_buf_r(struct mparse *curp, struct
> mandoc_msg(MANDOCERR_BADCHAR, curp,
> curp->line, pos, "ignoring byte");
> i++;
> + if (pos >= (int)ln.sz)
> + resize_buf(&ln, 256);
> + ln.buf[pos++] = '?';
> continue;
> }
>
--
To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv
next prev parent reply other threads:[~2012-02-05 10:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-05 0:45 Joerg Sonnenberger
2012-02-05 10:17 ` Ingo Schwarze [this message]
2012-02-05 11:58 ` Joerg Sonnenberger
2012-02-05 12:06 ` Ingo Schwarze
2012-02-05 14:35 ` Joerg Sonnenberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120205101744.GA15816@iris.usta.de \
--to=schwarze@usta.de \
--cc=discuss@mdocml.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).