From: "nagachika (Tomoyuki Chikanaga) via ruby-core" Date: 2023-03-25T02:26:13+00:00 Subject: [ruby-core:113007] [Ruby master Bug#19243] Windows: Dir.home returns string in wrong encoding Issue #19243 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 2.7: UNKNOWN, 3.0: REQUIRED, 3.1: REQUIRED to 2.7: UNKNOWN, 3.0: REQUIRED, 3.1: DONE ruby_3_1 823835499539aa53128a025ab72eb00c288dfb09 merged revision(s) d6ce4180a5b4dacbac895c9911031a6df6c61136. ---------------------------------------- Bug #19243: Windows: Dir.home returns string in wrong encoding https://bugs.ruby-lang.org/issues/19243#change-102541 * Author: larskanis (Lars Kanis) * Status: Closed * Priority: Normal * ruby -v: ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x64-mingw-ucrt] * Backport: 2.7: UNKNOWN, 3.0: REQUIRED, 3.1: DONE ---------------------------------------- Create a new local user on Windows called "kanis�". Then login to the new user and run in cmd: ``` C:\Users\kanis�>ruby -e "p Dir.home" "C:/Users/kanis\xE4" C:\Users\kanis�>ruby -e "p Dir.home.encoding" # C:\Users\kanis�>ruby -e "p Dir.home.encode('utf-8', 'iso-8859-15')" "C:/Users/kanis�" C:\Users\kanis�>echo %USERPROFILE% C:\Users\kanis� ``` `Dir.home` should encode the path in UTF-8. Instead the string is labeled as UTF-8 but bytes are encoded in `iso-8859-15`. All versions between ruby-3.0 and current master branch are affected. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/