diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-09-10 19:33:08 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-09-10 19:33:08 -0700 |
commit | a615af8eff76e33bb5bd4dcd591d2857096f6258 (patch) | |
tree | 8bfdd430d915b09bd8e3ee05d7f169845a02ad4b /lib.c | |
parent | 595c0bee41e0c7286c9779ab8f08ca6ec140c8d7 (diff) | |
download | txr-a615af8eff76e33bb5bd4dcd591d2857096f6258.tar.gz txr-a615af8eff76e33bb5bd4dcd591d2857096f6258.tar.bz2 txr-a615af8eff76e33bb5bd4dcd591d2857096f6258.zip |
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.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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"); |