tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: "Anthony J. Bentley" <anthony@anjbe.name>
Cc: tech@mandoc.bsd.lv
Subject: Re: -Thtml: Use hexadecimal character references
Date: Fri, 14 Jul 2017 14:37:57 +0200	[thread overview]
Message-ID: <20170714123757.GA32226@athene.usta.de> (raw)
In-Reply-To: <60588.1499994336@cathet.us>

Hi,

Anthony J. Bentley wrote on Thu, Jul 13, 2017 at 07:05:36PM -0600:

> Since Unicode codepoints are universally referred to in hexadecimal,
> this would make the HTML source easier to reason about while debugging.
> I have learned many hexadecimal codepoints over the years, but not a
> single one in decimal.

I agree.  But codepoints conventionally use capital hex digits
and at least four of them.

Feel free to commit in the following form, if you agree,
and i'll merge to bsd.lv and adjust the test suite.

Thanks,
  Ingo


Index: html.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/html.c,v
retrieving revision 1.85
diff -u -p -r1.85 html.c
--- html.c	23 Jun 2017 02:31:39 -0000	1.85
+++ html.c	14 Jul 2017 12:33:16 -0000
@@ -451,7 +451,7 @@ print_encode(struct html *h, const char 
 		    (c > 0x7E && c < 0xA0))
 			c = 0xFFFD;
 		if (c > 0x7E) {
-			(void)snprintf(numbuf, sizeof(numbuf), "&#%d;", c);
+			(void)snprintf(numbuf, sizeof(numbuf), "&#x%.4X;", c);
 			print_word(h, numbuf);
 		} else if (print_escape(h, c) == 0)
 			print_byte(h, c);
@@ -514,7 +514,7 @@ print_otag(struct html *h, enum htmltag 
 		print_indent(h);
 	else if ((h->flags & HTML_NOSPACE) == 0) {
 		if (h->flags & HTML_KEEP)
-			print_word(h, "&#160;");
+			print_word(h, "&#x00A0;");
 		else {
 			if (h->flags & HTML_PREKEEP)
 				h->flags |= HTML_KEEP;
@@ -777,7 +777,7 @@ print_text(struct html *h, const char *w
 				h->flags |= HTML_KEEP;
 			print_endword(h);
 		} else
-			print_word(h, "&#160;");
+			print_word(h, "&#x00A0;");
 	}
 
 	assert(NULL == h->metaf);
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv

      reply	other threads:[~2017-07-14 12:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-14  1:05 Anthony J. Bentley
2017-07-14 12:37 ` Ingo Schwarze [this message]

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=20170714123757.GA32226@athene.usta.de \
    --to=schwarze@usta.de \
    --cc=anthony@anjbe.name \
    --cc=tech@mandoc.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).