[R] Code \255 no longer working to produce a short dash in base R PDF graphs

Ivan Krylov |kry|ov @end|ng |rom d|@root@org
Thu Feb 20 13:48:33 CET 2025


В Wed, 19 Feb 2025 11:36:15 +0000
Paul Sherliker via R-help <r-help using r-project.org> пишет:

> text(1, 11, "baseline\255defined")
> text(1, 9, "done")
> graphics.off()
> 
> They like that dash - but I never knew what it was called.
> 
> Recently work updated my PC to the latest version of Windows, and,
> perforce, I updated to the latest version of R (4.4.2).

Nowadays, the session encoding on appropriately new versions of Windows
is UTF-8 [*]. Previously, the native encoding of the R session
corresponded to the ANSI encoding of your computer, most likely CP1252.
Let's see what does \255 mean in that encoding:

iconv('\255', 'CP1252', '') |> utf8ToInt() |> as.hexmode()
# [1] "ad"

Does '\uad' work for you?

-- 
Best regards,
Ivan

[*]
https://blog.r-project.org/2020/05/02/utf-8-support-on-windows/index.html



More information about the R-help mailing list