You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Child-process arguments with non-ASCII characters are garbled on Windows with R 4.1 and earlier #19649
Found by reading the code while working on #19640; not reproduced.
Many call sites convert a path with string_utils::utf8ToSystem() before handing it to a child process, as the program path or an argument (e.g. SessionBuild.cpp, SessionQuarto.cpp, SessionCompilePdf.cpp, the pandoc and panmirror helpers), or before embedding it in R code run by a child R process (e.g. ScriptJob.cpp, SessionRPubs.cpp, SessionHTMLPreview.cpp).
On Windows, Win32ChildProcess builds the command line with string_utils::utf8ToWide() (src/cpp/core/system/Win32ChildProcess.cpp:534, :551), which expects UTF-8. With R 4.2 and later, RStudio runs rsession-utf8.exe, whose code page is UTF-8, so utf8ToSystem() is a no-op and this works. With R 4.1 and earlier it runs rsession.exe, where utf8ToSystem() converts to the system code page. utf8ToWide() then reads those code-page bytes as UTF-8, so a non-ASCII character such as é would reach the child as U+FFFD.
If that holds, the fix is to drop utf8ToSystem() wherever the result only goes to a child process. Environment variables look the same: core::system::setenv() also converts with utf8ToWide() (src/cpp/core/system/Win32Environment.cpp:141), yet RS_RPOSTBACK_PATH is set from utf8ToSystem() (src/cpp/session/SessionMain.cpp:2886).
Activity