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
Windows 11: Console corrupts UTF-8 input after pressing Enter until Sys.setlocale() is called #18139
Immediately after starting RStudio, typing Turkish characters directly into the Console works while typing, but after pressing Enter the echoed text becomes corrupted.
Thanks again for the detailed report. We suspect this is related to the locale name containing a non-ASCII character -- Windows 11 renamed Turkey to Türkiye, so the default Turkish locale is now Turkish_Türkiye.utf8 -- similar to what we've seen with Norwegian Bokmål_Norway.utf8 in #15008. To help us pin down exactly which conversion is failing, could you share some diagnostics from a fresh RStudio session, before calling Sys.setlocale() or any workaround? (If your .Rprofile runs fix_tr() or similar, please disable that temporarily first.)
Type "Çalışma" into the Console, press Enter, and paste exactly what the corrupted text looks like (e.g. Çalışma-style mojibake, \u-style escapes, ? characters, ...). The shape of the corruption tells us which direction of conversion is failing.
Still before any workaround, the output of:
charToRaw("Çalışma")
Is the Windows option "Beta: Use Unicode UTF-8 for worldwide language support" enabled on your system? (Settings > Time & Language > Language & Region > Administrative language settings > Change system locale...)
For the list.files() symptom: do the file names (or the path of the working directory) contain Turkish characters? And does list.files() print any warnings along with character(0)?
And if you have a chance to try the previous RStudio release as mentioned above, that would still be very helpful in determining whether this is a regression.
Here are the diagnostics from a fresh RStudio session before applying any workarounds:
Locale & Environment Outputs
Sys.getlocale()
[1] "C"
l10n_info()
$MBCS
[1] TRUE
$UTF-8
[1] TRUE
$Latin-1
[1] FALSE
$codepage
[1] 65001
$system.codepage
[1] 65001
Sys.getenv(c("LC_ALL", "LC_CTYPE", "LANG"))
LC_ALL LC_CTYPE LANG
"" "" ""
2.. Console Corruption Behavior
When typing "Çalışma" into the Console and pressing Enter, it results in a syntax error with corrupted escape characters:
Çalışma
Error: unexpected '\' in "al"
Answers to your additional questions:
Question 4 (Beta: Use Unicode UTF-8...): Yes, this option is enabled on my Windows system.
Question 5 (list.files() symptom): Yes, the file names (and the path of the working directory) do contain Turkish characters.
Hi Kevin,
I have tested the latest daily build which includes your fix for #18141 (commit b7a69bd), but unfortunately, the issue persists in a fresh session.
As soon as I start RStudio:
Sys.getlocale() still returns "C".
Console displays corrupted Turkish characters.
I noticed your note in the PR mentions that the fix might not fully resolve the startup-time corruption and that you might need a "Windows repro." Please let me know what specific logs or additional diagnostics you would like me to provide to help you investigate the root cause of this startup behavior.
Best regards.
Hi Kevin,
Thank you for the suggestion. I tested running Sys.setlocale("LC_ALL", "") manually in the console, and it initially resolves the issue.
After running the command, Turkish characters are parsed correctly (returning an "object not found" error instead of the previous syntax error caused by character corruption):
However, the fix is temporary. After running View(x) to open the Data Viewer, the session reverts back to the corrupted state, and Sys.getlocale() returns "C" again:
View(df)
Sys.getlocale()
[1] "C"
It seems like interacting with the Data Viewer/Object Explorer triggers the same locale-clobbering behavior you described in your technical notes.
Activity
kevinushey commentedon Jul 3, 2026
Thanks for the bug report. Did this problem occur in the previous release of RStudio? Installers are available here: https://docs.posit.co/supported-versions/rstudio.html
kevinushey commentedon Jul 4, 2026
Thanks again for the detailed report. We suspect this is related to the locale name containing a non-ASCII character -- Windows 11 renamed Turkey to Türkiye, so the default Turkish locale is now
Turkish_Türkiye.utf8-- similar to what we've seen withNorwegian Bokmål_Norway.utf8in #15008. To help us pin down exactly which conversion is failing, could you share some diagnostics from a fresh RStudio session, before callingSys.setlocale()or any workaround? (If your.Rprofilerunsfix_tr()or similar, please disable that temporarily first.)The output of:
Type
"Çalışma"into the Console, press Enter, and paste exactly what the corrupted text looks like (e.g.Çalışma-style mojibake,\u-style escapes,?characters, ...). The shape of the corruption tells us which direction of conversion is failing.Still before any workaround, the output of:
charToRaw("Çalışma")Is the Windows option "Beta: Use Unicode UTF-8 for worldwide language support" enabled on your system? (Settings > Time & Language > Language & Region > Administrative language settings > Change system locale...)
For the
list.files()symptom: do the file names (or the path of the working directory) contain Turkish characters? And doeslist.files()print any warnings along withcharacter(0)?And if you have a chance to try the previous RStudio release as mentioned above, that would still be very helpful in determining whether this is a regression.
use _wsetlocale() in utf8ToConsole() locale save/restore
fix dangling setlocale restore and log locale sync failures on windows (
mplt58 commentedon Jul 4, 2026
Hi Kevin,
thank you for your interest.
Here are the diagnostics from a fresh RStudio session before applying any workarounds:
$
UTF-8[1] TRUE
$
Latin-1[1] FALSE
$codepage
[1] 65001
$system.codepage
[1] 65001
Question 4 (Beta: Use Unicode UTF-8...): Yes, this option is enabled on my Windows system.
Question 5 (list.files() symptom): Yes, the file names (and the path of the working directory) do contain Turkish characters.
Thank you.
Muhsin
Revert Windows VS 2026 (msvc145) toolchain migration (#18156)
mplt58 commentedon Jul 7, 2026
Hi Kevin,
I have tested the latest daily build which includes your fix for #18141 (commit b7a69bd), but unfortunately, the issue persists in a fresh session.
As soon as I start RStudio:
Sys.getlocale() still returns "C".
Console displays corrupted Turkish characters.
I noticed your note in the PR mentions that the fix might not fully resolve the startup-time corruption and that you might need a "Windows repro." Please let me know what specific logs or additional diagnostics you would like me to provide to help you investigate the root cause of this startup behavior.
Best regards.
kevinushey commentedon Jul 7, 2026
Doh -- thanks for testing. One thing that would be useful to know: does adding a call to
to your
~/.Rprofilemake any difference? (Or, running that by hand in your R console?)mplt58 commentedon Jul 7, 2026
Hi Kevin,
Thank you for the suggestion. I tested running Sys.setlocale("LC_ALL", "") manually in the console, and it initially resolves the issue.
After running the command, Turkish characters are parsed correctly (returning an "object not found" error instead of the previous syntax error caused by character corruption):
However, the fix is temporary. After running View(x) to open the Data Viewer, the session reverts back to the corrupted state, and Sys.getlocale() returns "C" again:
repair the windows locale when it is changed behind r's back (#18657)