rticulate / import

An Import Mechanism For R
https://import.rticulate.org
Other
222 stars 14 forks source link

Support encoding when importing R source files #51

Closed psychelzh closed 2 years ago

psychelzh commented 3 years ago

Currently, there is no option to set encoding of the importing file. This is very useful on Windows platform.

torfason commented 3 years ago

International characters are very important (I rely on the Icelandic characters þ,æ,ð,ö and others myself). In general I feel that utf8 should be the solution (i.e. all source files and text in utf8, rather than setting encoding). However, I understand that there might be issues with that approach.

A few questions related to this:

The underlying function that import uses is sys.source(), which does not have an encoding parameter, so if the answers to the above questions are not „good“ then the fix might be difficult. It seems that a discussion about the testthat package from a few years back is focused on a very similar issue, is there something there that might help (https://github.com/r-lib/testthat/issues/28)?

torfason commented 2 years ago

To the extent that the issue is a request for support of non-utf8 source files, I'm marking this as wontfix.

torfason commented 2 years ago

Closing as wontfix. Feel free to reopen based on the answers to the points mentioned above, that is:

  • Is it the case that a script with international characters encoded in utf8 is not correctly imported?
  • If yes to the above, is there a reason it not possible to save the script in utf8?
  • if no to the above, I wonder if the value of getOption("encoding") is respected?