From tlumley at u.washington.edu  Fri Oct 27 17:34:18 2006
From: tlumley at u.washington.edu (Thomas Lumley)
Date: Fri, 27 Oct 2006 08:34:18 -0700 (PDT)
Subject: [Rd] Error: invalid multibyte string
In-Reply-To: <59d7961d0610261838m3dea1a2eq24d5a8b84c2a1b82@mail.gmail.com>
References: <59d7961d0610251931i3d2a8a55x308bae32e5668236@mail.gmail.com> 
	<Pine.LNX.4.64.0610260824520.9367@homer23.u.washington.edu> 
	<x2hcxrrpry.fsf@turmalin.kubism.ku.dk>
	<59d7961d0610261838m3dea1a2eq24d5a8b84c2a1b82@mail.gmail.com>
Message-ID: <Pine.LNX.4.64.0610270826140.27715@homer23.u.washington.edu>

On Fri, 27 Oct 2006, Henrik Bengtsson wrote:

> In Section "Package subdirectories" in "Writing R Extensions" [2.4.0
> (2006-10-10)] it says:
>
> "Only ASCII characters (and the control characters tab, formfeed, LF
> and CR) should be used in code files. Other characters are accepted in
> comments, but then the comments may not be readable in e.g. a UTF-8
> locale. Non-ASCII characters in object names will normally [1] fail
> when the package is installed. Any byte will be allowed [2] in a
> quoted character string (but \uxxxx escapes should not be used), but
> non-ASCII character strings may not be usable in some locales and may
> display incorrectly in others.", where the footnote [2] reads "It is
> good practice to encode them as octal or hex escape sequences".
>
> (Note: ASCII refers (correctly) to the 7-bit ASCII [0-127] and none of
> the 8-bit ASCII extensions [128-255].)
>
> According to sentense about quoted strings, the following R/*.R code
> should still be valid:
>
>    pads <- sapply(0:64, FUN=function(x) paste(rep("\xFF", x), collapse=""));

That looks like it should be valid (at least according to the 
documentation), even though it won't run usefully on UTF-F locales.  What 
you wrote before was:

>> > On Thu, 26 Oct 2006, Henrik Bengtsson wrote:
>> >
>> > > I'm observing the following on different platforms:
>> > >
>> > >> parse(text='"\\x7F"')
>> > > expression("\177")
>> > >> parse(text='"\\x80"')
>> > > Error: invalid multibyte string

and that error *is* correct behaviour -- you can't parse() something that 
isn't a valid character string.

 	-thomas




[Rd] Error: invalid multibyte string
Thomas Lumley