Issue #12654 has been updated by Dvis Mosns.


Nobuyoshi Nakada wrote:
> Dvis Mosns wrote:
> > That's not really needed. For example `File.read` works with any console's codepage. But `Dir.entries` and `Dir.pwd` works only for ANSI paths no matter what console's codepage is set to. There's quite inconsistency between what encodings are used and IMO best solution is just use UTF-8 everywhere.
> 
> I think they should be the console's codepage (or "locale" encoding), not UTF-8 always.

I strongly disagree. WinAPI, PowerShell and cmd supports Unicode independently of used codepage, you can navigate to paths which can't be represented with active codepage. There's really no reason to make such arbitrary limitation. Such limitation would force everyone to use UTF-8 codepage because otherwise Ruby applications won't be able to handle Unicode paths/filenames.

By default cmd opens in OEM codepage and it needs to be specifically changed. Also for example if other applications start Ruby's process with CREATE_NO_WINDOW passed to CreateProcess then Ruby will have OEM codepage or if with DETACHED_PROCESS then it will be ANSI codepage and this isn't easily changeable by parent process.

Codepages are legacy thing and it would cause only more problems and confusion. By using UTF-8 we get full Unicode support and it doesn't matter what is active codepage.


----------------------------------------
Feature #12654: On Windows use UTF-8 as filesystem encoding
https://bugs.ruby-lang.org/issues/12654#change-59960

* Author: Dvis Mosns
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
Windows (NTFS) supports Unicode and there can be paths/filenames with other characters than current ANSI/OEM codepage can encode.

See attached patch.


---Files--------------------------------
0001-On-Windows-use-UTF-8-as-filesystem-encoding.patch (10.4 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>