From a615af8eff76e33bb5bd4dcd591d2857096f6258 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 10 Sep 2019 19:33:08 -0700 Subject: printer: put out BOM character as #\xFEFF. * lib.c (obj_print_impl): The Unicode BOM is also a zero width non-breaking space, which causes it to look like the incomplete #\ syntax. Let's instead render it as #\xFEFF. A few other hex cases are moved up into the surrounding switch, and a little goto takes care of avoiding code duplication. --- lib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib.c b/lib.c index 3b2aa4af..467b1785 100644 --- a/lib.c +++ b/lib.c @@ -11513,10 +11513,13 @@ dot: case 27: put_string(lit("esc"), out); break; case ' ': put_string(lit("space"), out); break; case 0xDC00: put_string(lit("pnul"), out); break; + case 0xFEFF: case 0xFFFE: case 0xFFFF: + goto fourhex; default: if ((ch < 0x20) || (ch >= 0x7F && ch < 0xA0)) fmt = lit("x~,02X"); - else if ((ch >= 0xD800 && ch < 0xE000) || ch == 0xFFFE || ch == 0xFFFF) + else if (ch >= 0xD800 && ch < 0xE000) + fourhex: fmt = lit("x~,04X"); else if (ch >= 0xFFFF) fmt = lit("x~,06X"); -- cgit v1.2.3