I've recently made a series of edits to source and documentation code to an R package, and when I attempt to render documentation (using devtools::check_man()
) I receive the error:
'DESCRIPTION' file has an 'Encoding' field and re-encoding is not possible
As far as I can tell, this indicates that I have included some non-ASCII characters somewhere in the source code of my package.
How can I track down the problematic characters?
I've tried using RStudio's "find in files" with the regular expression [^\x00-\x7F]
(per (grep) Regex to match non-ASCII characters?), but this matches almost every line of my code.
slava-kohut suggests (in comments)
lapply(list.files(include.dirs=FALSE, full.names=TRUE, no..=TRUE),
tools::showNonASCIIfile)
This finds a non-ASCII character in a file that's included in .Rbuildignore
, and then throws the error
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") : cannot open file './data': Permission denied