From: usa@... Date: 2015-12-27T14:33:28+00:00 Subject: [ruby-dev:49462] [Ruby trunk - Bug #11900] broken encoding of commandline on Windows Issue #11900 has been updated by Usaku NAKAMURA. 以下のパッチで直る(?)ような気がしますが、どうでしょうか>なかださん ~~~ Index: ruby.c =================================================================== --- ruby.c (リビジョン 53345) +++ ruby.c (作業コピー) @@ -1535,6 +1535,9 @@ process_options(int argc, char **argv, struct cmdl } else { eenc = lenc; +#if UTF8_PATH + opt->e_script = str_conv_enc(opt->e_script, rb_utf8_encoding(), eenc); +#endif } rb_enc_associate(opt->e_script, eenc); if (!(opt->dump & ~DUMP_BIT(version_v))) { ~~~ ---------------------------------------- Bug #11900: broken encoding of commandline on Windows https://bugs.ruby-lang.org/issues/11900#change-55786 * Author: Usaku NAKAMURA * Status: Assigned * Priority: Normal * Assignee: Nobuyoshi Nakada * ruby -v: ruby 2.4.0dev (2015-12-27 trunk 53345) [x64-mswin64_100] * Backport: 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED, 2.3: REQUIRED ---------------------------------------- 今頃気付いてしまったのですが、2.2以降のWindowsで、コマンドラインのエンコーディングが壊れています。 思い返すと、ちょうど1年前くらいになかださんがこの辺をいじっていたので、その時からではないかと。 trunkはもうめんどくさいからEncodingをUTF-8にしちゃっていい気がしますが、2.2と2.3はどうしたものすかね。 ~~~ C:\>c:\ruby\2.1.8\bin\ruby -ve "s = 'てすと'; p [s, s.encoding, s.b]" ruby 2.1.8p440 (2015-12-16 revision 53160) [x64-mswin64_100] ["てすと", #, "\x82\xC4\x82\xB7\x82\xC6"] C:\>c:\ruby\2.2.4\bin\ruby -ve "s = 'てすと'; p [s, s.encoding, s.b]" ruby 2.2.4p230 (2015-12-16 revision 53155) [x64-mswin64_100] ["縺ヲ縺吶→", #, "\xE3\x81\xA6\xE3\x81\x99\xE3\x81\xA8"] C:\>c:\ruby\2.3.0\bin\ruby -ve "s = 'てすと'; p [s, s.encoding, s.b]" ruby 2.3.0p0 (2015-12-25 revision 53290) [x64-mswin64_100] ["縺ヲ縺吶→", #, "\xE3\x81\xA6\xE3\x81\x99\xE3\x81\xA8"] C:\>ruby -ve "s = 'てすと'; p [s, s.encoding, s.b]" ruby 2.4.0dev (2015-12-27 trunk 53345) [x64-mswin64_100] ["縺ヲ縺吶→", #, "\xE3\x81\xA6\xE3\x81\x99\xE3\x81\xA8"] ~~~ -- https://bugs.ruby-lang.org/