On Mon, 27 Aug 2018, Sven Schreiber wrote:
I'm having problems on Windows using a file name with non-Latin
characters
inside a foreign language R block, in the gretl.loadmat function. If I stick
to ASCII characters, it works. On Linux, it also works.
This is with a gretl snapshot and with R 3.5.1 (tried with 3.3.2 before), on
Win 7. Don't know if there's anything gretl can do there?
In the gretl script window all text is UTF-8, so the filename will be
passed to R in UTF-8 -- and therefore it will not work "as is" to
access the file on Windows, which doesn't do UTF-8.
I think the solution is (a) make sure your locale is set correctly
within R, using Sys.setlocale() if need be, and (b) tell R that the
incoming filename is in UTF-8. For the read.table() function this
would be a matter of appending the argument 'encoding="utf-8"',
as in
m <- as.matrix(read.table(fname, skip=1, encoding-"utf-8"))
If you can confirm that this works (for some UTF-8 path of your
choosing) we can add the encoding spec to the gretl.loadmat function
for R on Windows.
See also
https://stackoverflow.com/questions/5031630/how-to-source-r-file-saved-us...
Allin