[Rd] Printing Unicode escapes with 6 digits may be problematic

Korpela Mikko (MML) m|kko@korpe|@ @end|ng |rom m@@nm|tt@u@|@|to@@||
Thu Jan 7 12:07:45 CET 2021


I see that this was only a passing issue. R-devel r79638 and greater (also tested with r79801) print six digits inside curly brace delimiters, like so: "\U{016fe4}1" (using the example below). This ensures compatibility between output and input.

- Mikko

-----Alkuperäinen viesti-----
Lähettäjä: R-devel <r-devel-bounces using r-project.org> Puolesta Korpela Mikko (MML)
Lähetetty: maanantai 14. joulukuuta 2020 11.51
Vastaanottaja: r-devel <r-devel using r-project.org>
Aihe: [Rd] Printing Unicode escapes with 6 digits may be problematic

A recent R-devel commit introduces a change in the way non-printable Unicode characters are shown as an escape code. Whereas large code points were previously printed using an escape code of 8 hexadecimal digits, with initial zeros, the present code (tested with R-devel r79623 on Ubuntu Linux) only prints 6 hex digits. I think this may be problematic: it is now possible that R prints a character string which is not valid when reused as an input. See the following example.

"\U{16FE4}1"
# [1] "\U016fe41"
"\U016fe41"
# Error: invalid \Uxxxxxxxx value 16fe41 (line 1)

Best regards,
- Mikko Korpela

______________________________________________
R-devel using r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list