Tomas Kalibera
2022-May-20 18:50 UTC
[Rd] Rgui.exe: bug associated with non-ASCII characters
On 5/20/22 03:36, jcfaria wrote:> Sorry, I noticed the bug but I really forgot to add the "c", for > combine arguments, when I wrote the email. > > In fact, adding "c" R accepts sending the selection and copy/paste, > but it does not accept the sending with the cursor at the beginning of > the line. > > v1 <- c('p?', 'p?', 'p?', 'p?', 'p?') > > Place the cursor at the beginning of the line and try to send it via > CTRL+R > > > v1 <- c('p > ? + >Thanks, I can reproduce the problem. Rgui uses via GraphApp an ANSI RichEdit window to implement the script editor. What happens is that the text obtained from that window is in Latin 1 encoding (on my machine, probably also on yours), even though Rgui runs in UTF-8 via the active code page specified in the manifest file, which I find rather surprising. You can see that even in R 4.1, you cannot use characters not representable in your native/ANSI encoding in the editor window. But, now you cannot even use characters with different representation between your ANSI code page and UTF-8 encoding (so only ASCII is safe). I will investigate further how this could be fixed, it may not be completely trivial as there are also other operations on the content of the window, and it would really be nice if the RichEdit window could be made to respect the active code page. Best Tomas> Best, > ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ > Jose Claudio Faria > UESC/DCET/Brasil > joseclaudio.faria at gmail.com > Telefones: > 55(73)3680.5545 - UESC > 55(73)99966.9100 - VIVO > ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ > If you have software to deal with statistics, you have arms, > if you have good software, you have arms and legs, > if you have software like R, you have arms, legs and wings... > the height of your flight depends only on you. > > ------ Mensagem original ------ > De: "Brodie Gaslam" <brodie.gaslam at yahoo.com> > Para: "r-devel at r-project.org" <r-devel at r-project.org>; "jcfaria" > <joseclaudio.faria at gmail.com> > Enviado(s): 19/05/2022 19:55:17 > Assunto: Re: [Rd] Rgui.exe: bug associated with non-ASCII characters > >> Is it possible you intended to use: >> >> c('p?', 'p?', 'p?', 'p?', 'p?') >> >> instead of: >> >> ('p?', 'p?', 'p?', 'p?', 'p?') >> >> Note the missing `c` in the second one.? That's just not a valid R >> expression. >> >> I don't use Rgui but if I just type (1,2) in my R terminal I get the >> same error. >> >> Best, >> >> B. >> >> >> >> >> >> On Thursday, May 19, 2022, 06:01:40 PM EDT, jcfaria >> <joseclaudio.faria at gmail.com> wrote: >> >> >> >> >> >> Hello, >> >> R devel R82368 >> >> 1- Open Rgui.exe >> 2- New script (Rgui's built-in editor) >> 3- Type the below >> >> v1 <- ('p?', 'p?', 'p?', 'p?', 'p?') >> >> 4- Select the entire line and try to send using the shortcut CTRL+R >> >>> ?v1 <- ('p?', 'p?', 'p?', 'p?', '?') >> Error: unexpected ',' in "v1 <- ('p?'," >>> >> >> 5- If you try to select the entire text (CTRL+C) and to paste (CTRL+V) >> into the console: >> >>> ?v1 <- ('p?', 'p?', 'p?', 'p?', 'p?') >> Error: unexpected ',' in "v1 <- ('p?'," >>> >> >> i.e. the same result, >> >> 6- Place the cursor at the beginning of the line and try to send it via >> CTRL+R >> >>> ?v1 <- ('p >> + >> >> We have a problem there, don't we? >> >> Best, >> ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ >> Jose Claudio Faria >> UESC/DCET/Brasil >> joseclaudio.faria at gmail.com >> Telefones: >> 55(73)3680.5545 - UESC >> 55(73)99966.9100 - VIVO >> ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ >> If you have software to deal with statistics, you have arms, >> if you have good software, you have arms and legs, >> if you have software like R, you have arms, legs and wings... >> the height of your flight depends only on you. >> >> ??? [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-devel at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel
Tomas Kalibera
2022-May-23 13:35 UTC
[Rd] Rgui.exe: bug associated with non-ASCII characters
On 5/20/22 20:50, Tomas Kalibera wrote:> > On 5/20/22 03:36, jcfaria wrote: >> Sorry, I noticed the bug but I really forgot to add the "c", for >> combine arguments, when I wrote the email. >> >> In fact, adding "c" R accepts sending the selection and copy/paste, >> but it does not accept the sending with the cursor at the beginning >> of the line. >> >> v1 <- c('p?', 'p?', 'p?', 'p?', 'p?') >> >> Place the cursor at the beginning of the line and try to send it via >> CTRL+R >> >> > v1 <- c('p >> ? + >> > Thanks, I can reproduce the problem. Rgui uses via GraphApp an ANSI > RichEdit window to implement the script editor. What happens is that > the text obtained from that window is in Latin 1 encoding (on my > machine, probably also on yours), even though Rgui runs in UTF-8 via > the active code page specified in the manifest file, which I find > rather surprising. You can see that even in R 4.1, you cannot use > characters not representable in your native/ANSI encoding in the > editor window. But, now you cannot even use characters with different > representation between your ANSI code page and UTF-8 encoding (so only > ASCII is safe). I will investigate further how this could be fixed, it > may not be completely trivial as there are also other operations on > the content of the window, and it would really be nice if the RichEdit > window could be made to respect the active code page.Now fixed in R-devel (82394). Once the R-devel snapshot build is of this or later release, could you please test? Ideally not only this example, but also other uses of the script editor. Thanks. Technically, after some more investigation I found out that RichEdit20W class of the Rich Edit control (so the Unicode version of it) actually respects the ACP when it is UTF-8, even when using the *A interface. RichEdit20A class doesn't. I don't see this in the documentation, though. Compared to R 4.1, one can now use in the script editor even characters not representable in the Windows ANSI encoding. All scripts saved to disk should be now in UTF-8 to be used with the script editor (on recent Windows where the native encoding in R is UTF-8), if they contain any non-ASCII characters. Best Tomas> > Best > Tomas > > >> Best, >> ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ >> Jose Claudio Faria >> UESC/DCET/Brasil >> joseclaudio.faria at gmail.com >> Telefones: >> 55(73)3680.5545 - UESC >> 55(73)99966.9100 - VIVO >> ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ >> If you have software to deal with statistics, you have arms, >> if you have good software, you have arms and legs, >> if you have software like R, you have arms, legs and wings... >> the height of your flight depends only on you. >> >> ------ Mensagem original ------ >> De: "Brodie Gaslam" <brodie.gaslam at yahoo.com> >> Para: "r-devel at r-project.org" <r-devel at r-project.org>; "jcfaria" >> <joseclaudio.faria at gmail.com> >> Enviado(s): 19/05/2022 19:55:17 >> Assunto: Re: [Rd] Rgui.exe: bug associated with non-ASCII characters >> >>> Is it possible you intended to use: >>> >>> c('p?', 'p?', 'p?', 'p?', 'p?') >>> >>> instead of: >>> >>> ('p?', 'p?', 'p?', 'p?', 'p?') >>> >>> Note the missing `c` in the second one.? That's just not a valid R >>> expression. >>> >>> I don't use Rgui but if I just type (1,2) in my R terminal I get the >>> same error. >>> >>> Best, >>> >>> B. >>> >>> >>> >>> >>> >>> On Thursday, May 19, 2022, 06:01:40 PM EDT, jcfaria >>> <joseclaudio.faria at gmail.com> wrote: >>> >>> >>> >>> >>> >>> Hello, >>> >>> R devel R82368 >>> >>> 1- Open Rgui.exe >>> 2- New script (Rgui's built-in editor) >>> 3- Type the below >>> >>> v1 <- ('p?', 'p?', 'p?', 'p?', 'p?') >>> >>> 4- Select the entire line and try to send using the shortcut CTRL+R >>> >>>> ?v1 <- ('p?', 'p?', 'p?', 'p?', '?') >>> Error: unexpected ',' in "v1 <- ('p?'," >>>> >>> >>> 5- If you try to select the entire text (CTRL+C) and to paste (CTRL+V) >>> into the console: >>> >>>> ?v1 <- ('p?', 'p?', 'p?', 'p?', 'p?') >>> Error: unexpected ',' in "v1 <- ('p?'," >>>> >>> >>> i.e. the same result, >>> >>> 6- Place the cursor at the beginning of the line and try to send it via >>> CTRL+R >>> >>>> ?v1 <- ('p >>> + >>> >>> We have a problem there, don't we? >>> >>> Best, >>> ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ >>> Jose Claudio Faria >>> UESC/DCET/Brasil >>> joseclaudio.faria at gmail.com >>> Telefones: >>> 55(73)3680.5545 - UESC >>> 55(73)99966.9100 - VIVO >>> ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ >>> If you have software to deal with statistics, you have arms, >>> if you have good software, you have arms and legs, >>> if you have software like R, you have arms, legs and wings... >>> the height of your flight depends only on you. >>> >>> ??? [[alternative HTML version deleted]] >>> >>> ______________________________________________ >>> R-devel at r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-devel >> >> ______________________________________________ >> R-devel at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel