Warning about UTF-8 with roxygen2

RUtf 8PackageRoxygen2

R Problem Overview


I have a problem about UTF-8. After conducting roxygen2::roxygenise() for my package, it showed the warning message 'roxygen2 requires Encoding: UTF-8'. How can I fix it?

roxygen2::roxygenise()

>     Writing NAMESPACE
>     
>     Loading ABXTT
>     
>     Writing NAMESPACE
>     
>     Warning message:
>     
>     roxygen2 requires Encoding: UTF-8

R Solutions


Solution 1 - R

Add:

Encoding: UTF-8

to your DESCRIPTION file.

Solution 2 - R

As James said,

Add: Encoding: UTF-8

to your DESCRIPTION file to eliminate the warning. You can find the documentation for the format of the DESCRIPTION file on CRAN). That standard includes this field to tell the rest of the build process which file encoding is used. CRAN defaults to use ASCII, so if you use something other than ASCII this field is needed.

As it turns out, roxygen as of 6.1.0 reads and writes files as UTF-8. As noted above this actually is in conflict with CRAN standards/defaults. So, at some point roxygen may stop writing files as UTF-8. Until then, your package documentation has been written as UTF-8 and you probably will need to add this line to avoid the warning.

Side note: UTF-8 reads as ASCII so long as there are no characters outside of the ASCII range (i.e. no special characters). So, in practice whether you remember to include this field or not may make no difference.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLannView Question on Stackoverflow
Solution 1 - RJames MelvilleView Answer on Stackoverflow
Solution 2 - RrussellpierceView Answer on Stackoverflow