Message-ID: <14BBEE00-C54A-463F-B5B4-43C10675A6AF@r-project.org>
Date: 2011-08-12T01:13:41Z
From: Simon Urbanek
Subject: Unicode characters in script?
In-Reply-To: <CAB5rbyV6GsN-+_0wp91ka3g3ELBSpb2o-P8iB9UZSoz0-v5U6w@mail.gmail.com>
On Aug 11, 2011, at 2:35 PM, Michael Hoban wrote:
> Hi all-
>
> I tried searching before posting, but this is one of those tricky
> questions to search for. My issue is this: within the R.app gui, I can
> use extended characters in plot labels without any issue (specifically
> in my case the ?, lowercase delta), for example:
>
>> plot(c(1:10) ~ c(1:10), main="?foobie bletch?")
>
> However, when I try to do the same in a script from the terminal
> (interpreted by Rscript), I get a bunch of errors related to character
> encoding:
> ....
> conversion failure on '?foobie bletch?' in 'mbcsToSbcs': dot
> substituted for <e2>
> ....
>
> Is there a way to make this work? Or is Rscript not equipped to handle
> multibyte characters?
>
It seems your'e running Rscript in a locale that doesn't support unicode (probably C). Make sure you use UTF-8 locale (e.g. LANG=en_US.UTF-8)
Cheers,
Simon