Am 27.08.2018 um 16:49 schrieb Allin Cottrell:


fname <- iconv(fname, from="utf-8", to="")
I'm getting "NA" as the result because the non-latin isn't possible to convert to my locale.


I haven't tested that yet but I'll explore a bit.

Here's what I've tried unsuccessfully (whereas with Python there's no problem):
-- But really, it's not a big deal, we can just avoid complicated file names (or stick to Python)...
-sven

<hansl>
# test filenames and foreign
matrix m = {1,2}

mwrite(m, "замок.mat", 1)

### python
foreign language=python
fn = "замок.mat"
mp = gretl_loadmat(fn) # works!
print(mp)
end foreign

### R
foreign language=R

print(Sys.getlocale())
# gives: "LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252 ... etc.
# (trying to set the locale to some UTF-8 thing didn't work)

fn <- "замок.mat"
print(fn)
fn <- paste(gretl.dotdir, fn, sep="")
print(fn)

fn <- iconv(fn, from="", to="UTF-8")
# (UTF-16 gives error, but this doesn't seem to help)

print(fn)

# mR <- as.matrix(read.table(fn, skip=1)) # fails
# mR <- gretl.loadmat(fn) # fails
end foreign
</hansl>