[R-pkg-devel] Check Error Due to Unicode in Documentation

Gábor Csárdi c@@rd|@g@bor @end|ng |rom gm@||@com
Thu Jul 23 23:25:04 CEST 2020


On Thu, Jul 23, 2020 at 9:58 PM Duncan Murdoch <murdoch.duncan using gmail.com> wrote:
>
> On 23/07/2020 4:14 p.m., bill using denney.ws wrote:
[...]
>
> If you change the source to include the explicit characters (i.e. use
> pattern = c("μ", "µ") instead of pattern=c("\u03bc", "\u00b5")), does
> that help?
>
> It may cause other issues:  WRE recommends against including UTF-8 chars
> in source code.
>
> If that doesn't solve the problem, then it looks like an issue with
> Roxygen2.  I don't know if there's a way to tell it not to convert \u
> escapes into the corresponding character.  If there isn't, it seems like
> that's something they should add.  As a workaround, is there a way to
> say that this one particular .Rd file should be edited by hand, instead
> of auto-generated?

I don't think roxygen2 intentionally converts \u sequences, I think
this is just a consequence of the parse() + deparse() roundtrip:

x <- '"\\u03bc"'
charToRaw(x)
#>  [1] 22 5c 75 30 33 62 63 22
y <- deparse(eval(parse(text = x)))
charToRaw(y)
#> [1] 22 b5 22

Bill, please report a roxygen2 issue at
https://github.com/r-lib/roxygen2/issues and we can probably fix this.
Thanks!

Gabor



More information about the R-package-devel mailing list