Following recommendations on https://yihui.name/en/2018/11/biggest-regret-knitr, I started saving my .R files with UTF-8 encoding (using RStudios "Save with encoding"). Seems to work well, until it comes to using spin_child.
Under Windows, for example I have a file mainfile.R with this code:
print("Bär 1"); spin_child("subfile.R")
subfile.R has this code:
print("Bär 2")
In RStudio under Windows, I run
rmarkdown::render("mainfile.R", encoding = "UTF-8")
If both files are saved with encoding UTF-8, Bär 1 comes out fine, but Bär 2 comes out as "Bär 2" (which seems like an encoding problem to me). Interestingly, if I change encoding of subfile.R to ISO-8859-1 (System default), both Bär come out correctly. It seems strange to me that I should have to use different encodings for different files, so I'm wonderning what I have to do if the input file for spin_child ist UTF-8 as well?