[Rd] String encoding problem

2016-07-07 Thread Hadley Wickham
If you print: "\xc9\x82\xbf" you get "\u0242\xbf" But if you try and evaluate that string you get: > "\u0242\xbf" Error: mixing Unicode and octal/hex escapes in a string is not allowed (Probably will only happen on mac/linux with default utf-8 encoding) Hadley -- http://hadley.nz __

Re: [Rd] String encoding problem

2016-07-07 Thread Duncan Murdoch
On 07/07/2016 10:57 AM, Hadley Wickham wrote: If you print: "\xc9\x82\xbf" you get "\u0242\xbf" But if you try and evaluate that string you get: "\u0242\xbf" Error: mixing Unicode and octal/hex escapes in a string is not allowed (Probably will only happen on mac/linux with default utf-8

Re: [Rd] String encoding problem

2016-07-07 Thread Hadley Wickham
On Thu, Jul 7, 2016 at 10:11 AM, Duncan Murdoch wrote: > On 07/07/2016 10:57 AM, Hadley Wickham wrote: >> >> If you print: >> >> "\xc9\x82\xbf" >> >> you get >> >> "\u0242\xbf" >> >> But if you try and evaluate that string you get: >> >>> "\u0242\xbf" >> >> Error: mixing Unicode and octal/hex es

Re: [Rd] String encoding problem

2016-07-07 Thread Simon Urbanek
> On Jul 7, 2016, at 11:40 AM, Hadley Wickham wrote: > > On Thu, Jul 7, 2016 at 10:11 AM, Duncan Murdoch > wrote: >> On 07/07/2016 10:57 AM, Hadley Wickham wrote: >>> >>> If you print: >>> >>> "\xc9\x82\xbf" >>> >>> you get >>> >>> "\u0242\xbf" >>> >>> But if you try and evaluate that stri

Re: [Rd] String encoding problem

2016-07-07 Thread Hadley Wickham
>>> I'm not sure what should happen here, but that's not a legal string in a >>> UTF-8 locale, so it's not too surprising that things go wonky. >> >> Here's bit more context on how I got that sequence of bytes: >> >> x <- "こんにちは" >> y <- iconv(x, to = "Shift-JIS") >> Encoding(y) >> y >> >> I did th

Re: [Rd] String encoding problem

2016-07-07 Thread peter dalgaard
> On 07 Jul 2016, at 18:15 , Hadley Wickham wrote: > > Right - I'm aware of that. But to me, it doesn't seem correct to > print a string that is not a valid R string. Why is an unknown > encoding printed like UTF-8? > It isn't -- no UTF-8 would have the \xbf. I may be flogging a dead horse, b

[Rd] Detecting user interrupts in R_tryEval

2016-07-07 Thread Jeroen Ooms
Is there any way to distinguish between an error and a user interruption in R_tryEval? In both cases the ErrorOccurred argument is set to 1. For my application I need a different action in case of a SIGINT. >From the source code I infer that R_tryEval basically wraps eval in R_ToplevelExec, which

Re: [Rd] Detecting user interrupts in R_tryEval

2016-07-07 Thread William Dunlap via R-devel
In R code tryCatch can detect the difference. Hit control-C (on Unixen) or Escape (on Windows) to interrupt the long-running for loop and see that the interrupt clause gets called: > z <- tryCatch(for(i in seq_len(1e8))log(exp(i/10)), error=function(e)e, interrupt=function(e)e) ^C> dput(z) struct

Re: [Rd] String encoding problem

2016-07-07 Thread Duncan Murdoch
On 07/07/2016 12:51 PM, peter dalgaard wrote: > On 07 Jul 2016, at 18:15 , Hadley Wickham wrote: > > Right - I'm aware of that. But to me, it doesn't seem correct to > print a string that is not a valid R string. Why is an unknown > encoding printed like UTF-8? > It isn't -- no UTF-8 would hav

[Rd] Error building Tcl: R-patched_2016-07-05

2016-07-07 Thread Avraham Adler
I am trying to build R under 64bit Windows7. I am using a fresh install of Rtools34 and R-patched_2016-07-05. I am getting the following error: C:/Rtools/mingw_64/bin/gcc -shared -s -static-libgcc -o tcltk.dll tmp.def init.o tcltk.o tcltk_win.o ../../../gnuwin32/dllversion.o -L../../../../Tcl/bin

Re: [Rd] Error building Tcl: R-patched_2016-07-05

2016-07-07 Thread Duncan Murdoch
On 07/07/2016 5:47 PM, Avraham Adler wrote: I am trying to build R under 64bit Windows7. I am using a fresh install of Rtools34 and R-patched_2016-07-05. I am getting the following error: C:/Rtools/mingw_64/bin/gcc -shared -s -static-libgcc -o tcltk.dll tmp.def init.o tcltk.o tcltk_win.o ../../