From kbarton at zbs.bialowieza.pl  Fri Feb 20 02:20:09 2009
From: kbarton at zbs.bialowieza.pl (kbarton at zbs.bialowieza.pl)
Date: Fri, 20 Feb 2009 02:20:09 +0100 (CET)
Subject: [Rd] "source" fails to handle non-ascii variable names (PR#13541)
Message-ID: <20090220012009.AE408282EFF8@mail.pubhealth.ku.dk>

If there is variable name in the source file which contains non-ascii cha=
racters, "source" gives an=20
"unexpected $end" error after first such character (even if proper file e=
ncoding is provided).
This also happens with parse, when "file" is a textConnection, but not if=
 the same code is provided=20
by "text" argument.
This problem seems to occur only on Windows.

Examples:

 > con <- textConnection("=C4=85=C4=99=C4=87=C5=BA <- 12345")
 > parse(con)
Error in parse(con) : unexpected $end at
1: =C4=85

# backtick quoted names are parsed correctly:

 > con <- textConnection("`=C4=85=C4=99=C4=87=C5=BA` <- 12345")
 > parse(con)
expression(=C4=85=C4=99=C4=87=C5=BA <- 12345)


# also, parsing as text works:

 > con <- textConnection("=C4=85=C4=99=C4=87=C5=BA <- 12345")
 > parse(text=3DreadLines(con))
expression(=C4=85=C4=99=C4=87=C5=BA <- 12345)
attr(,"srcfile")
<text>



Version:
  platform =3D i386-pc-mingw32
  arch =3D i386
  os =3D mingw32
  system =3D i386, mingw32
  status =3D
  major =3D 2
  minor =3D 8.1
  year =3D 2008
  month =3D 12
  day =3D 22
  svn rev =3D 47281
  language =3D R
  version.string =3D R version 2.8.1 (2008-12-22)

Windows XP (build 2600) Service Pack 3

Locale:
LC_COLLATE=3DPolish_Poland.1250;LC_CTYPE=3DPolish_Poland.1250;LC_MONETARY=
=3DPolish_Poland.1250;LC_NUMERIC=3DC;LC_TIME=3DPolish_Poland.1250



[Rd] "source" fails to handle non-ascii variable names (PR#13541)
kbarton at zbs.bialowieza.pl