Escapes non-ASCII string literals to \uXXXX and transliterates comments / roxygen so the package passes CRAN's "non-ASCII characters" check. Dry-run by default: pass dry_run = FALSE to actually rewrite files. Wraps asciify_pkg().

fix_ascii(
  pkg = ".",
  scope = c("R", "tests", "vignettes"),
  strategy = c("auto", "escape", "translit", "report"),
  identifiers = c("error", "warn", "skip"),
  dry_run = TRUE
)

Arguments

pkg

Path to the package to rewrite.

scope

Subdirectories to rewrite.

strategy

Rewrite strategy (see asciify_r_source()).

identifiers

What to do when a non-ASCII identifier is found.

dry_run

If TRUE (default), only report what would change.

Value

Invisibly, a data frame of the changes per file.

Examples

if (FALSE) { # \dontrun{
pkg <- create_example_pkg()
fix_ascii(pkg, dry_run = TRUE)
} # }