Warning about UTF-8 with roxygen2
Asked Answered
O

2

69

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
Octavia answered 5/8, 2018 at 13:52 Comment(0)
Q
100

Add:

Encoding: UTF-8

to your DESCRIPTION file.

Quickman answered 6/8, 2018 at 2:9 Comment(1)
Can you explain why this is required and what it does?Teacart
A
43

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.

Austriahungary answered 15/12, 2018 at 11:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.