On Windows, encoding sucks in R, and is very complicated - and those developing packages don't always consider it as a real issue (see roxygen or devtools). What worked for me:
if you have data in your package with non-ASCII labels, e.g. a colorvector c(rød = "#C30000", blå = "#00A9E0"), you have to escape the names/values in code:
c(r\u00f8d = "#C30000", bl\u00e5 = "#00A9E0")
in the documentation (if you use roxygenize or devtools::document()) you have to place @encoding UTF-8 before EVERY function description but then use regular keyboard.
If you have two functions in the same file (e.g. "palette" and "saturation" in a design package for your organisation), you have to place the tag in every description block, not just once.
Example:
#' @encoding UTF-8
#' datastruktur for å definere firmapalett med æøå
dummypalett <- structure(.Data = c("#c30000", "#00A9E0"),
names = c("r\u00f8d", "bl\u00e5"))
#' @encoding UTF-8
#' neste funksjon som er beskrevet med æøåäö
For good measure, I placed Language: nob in the DESCRIPTION file and changed the encoding tag in Rprofile to "UTF-8".
\r{a}
for å (en.wikibooks.org/wiki/LaTeX/Special_Characters#Escaped_codes) but these seem not to be recognized by R CMD INSTALL – I wonder whether there is an option that "activates" these macros... – Stow