"Zoltán" in my pathname causing errors creating R notebook html

Getting set up on my personal laptop to create an R notebook, but it has problems recognizing my pathname.

"Zoltán" is my username, no problem for all other apps, but creating an R notebook, it can't recognize "á" and tries to recode it to "Zoltn" and then "Zoltán" and giving a warning:

Warning messages:
1: In native_encode(options$fig.path) :
some characters may not work under the current locale
2: In list.files(files_dir, "^figure-.+") :
unable to translate 'C:\Users\Zoltn\Documents

I am not changing my username. What other ways can I work around this, and successfully create R notebooks on my laptop?

Thanks,
Zoltán

Hi, could you use projects? That way you would not need to set the paths:

https://r4ds.had.co.nz/workflow-projects.html

Otherwise, you could try the here package:

Hi @ZoltanSzentkiralyi , maybe the problem is the accent mark in Zoltán. Put this in the console:

Sys.setlocale("LC_ALL", 'en_US.UTF-8’) 

Sys.setenv(LANGUAGE="en")

or 

Sys.setenv(LANGUAGE="es")
1 Like

I think this could be related to R on windows not being (yet) UTF-8 by default. The path is not handled properly because there seems to be an encoding issue when reading the path.

Is R seeing your path properly ? Without R Markdown I mean ? When you type getwd() ? or path.expand("~") ?

Thanks

I concur with this. Recently I taught a course on the Prague School of Economics, which is commonly abbreviated as VŠE (with accented S) and this abbreviation often figured in directory structure students used on their notebooks. I had the class structured as a project (a github repo) but even RStudio Projects did not shield us from encoding issues caused by naming of the parent of the project directory.

At the end the easiest solution was renaming the parent directory (VŠE >> VSE). Given the constraints it was not practical to try more finessed solutions / such as locale settings.

On Windows, I would suggest to try the current r-devel version which will now default to UTF-8 on windows. It should be available in next release, but trying as of now could help see if this is working better or not.

https://developer.r-project.org/Blog/public/2021/12/07/upcoming-changes-in-r-4.2-on-windows/index.html

R 4.2 for Windows will support UTF-8 as native encoding, which will be a major improvement in encoding support, allowing Windows R users to work with international text and data.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.