14

How do I specify encoding for rd file correctly? I'm trying to add the following help file documenting dummy function to my package:

\name{dummy}
\encoding{ISO-8859-2}
\alias{dummy}
\title{Příšerně žluťoučký kůň úpěl ďábelské ódy.}
\usage{
  dummy(x)
}
\arguments{
  \item{x}{Příšerně žluťoučký kůň úpěl ďábelské
  ódy.Příšerně žluťoučký kůň úpěl ďábelské ódy.}
}
\description{
  Příšerně žluťoučký kůň úpěl ďábelské ódy.Příšerně
  žluťoučký kůň úpěl ďábelské ódy.
}
\examples{
dummy(x="Příšerně žluťoučký kůň úpěl ďábelské ódy.Příšerně žluťoučký kůň úpěl ďábelské ódy.")
}

However, when I try to install my package (using install from devtools) I get:

Warning messages:
1: In fetch(key) : internal error -3 in R_decompress1
2: In strsplit(msg, "\n") : input string 1 is invalid in this locale

When I try help(dummy) I get:

Error in fetch(key) : lazy-load database '�' is corrupt

Any advice?

smci
  • 32,567
  • 20
  • 113
  • 146
Tomas Greif
  • 21,685
  • 23
  • 106
  • 155
  • Probably clean your environment, with `rm(ls=list())` and `source()` and try again?!? – maximus Aug 06 '13 at 12:40
  • 1
    Take a look here: http://cran.r-project.org/doc/manuals/R-exts.html#The-DESCRIPTION-file You should be able to specify encoding in your DESCRIPTION file. – Thomas Aug 06 '13 at 12:40
  • 13
    You'll need to restart R between invocations of `install`. – hadley Aug 07 '13 at 01:39

1 Answers1

3

I suspect this encoding might not be well handled by R. If I copy paste your function in a fake package, remove the mention to your encoding in the Rd file and save it with encoding UTF-8 and add

    Encoding: UTF-8

To the DESCRIPTION file it works fine (under linux, with UTF-8 local).

cmbarbu
  • 4,354
  • 25
  • 45