0

我在 UTF8 编码文件 01.rb 中有一个简单的 Ruby 脚本:

#encoding: utf-8
puts "Hello, Марина!"
gets

它在 Win7 控制台(cmd.exe)中完美运行,但是当我尝试在 ConEmu 中运行它时,它返回:

$ ruby 01.rb 
Hello, Р?Р°С?РёР?Р°!

尝试使用

$ chcp 65001

但收到:

D:/Programms/Ruby/Marcia/01/01.rb:1: [BUG] rb_sys_fail_path_in(io_write, <STDOUT>) - errno == 0
ruby 2.1.6p336 (2015-04-13 revision 50298) [i386-mingw32]

-- Control frame information -----------------------------------------------
c:0005 p:---- s:0012 e:000011 CFUNC  :write
c:0004 p:---- s:0010 e:000009 CFUNC  :puts
c:0003 p:---- s:0008 e:000007 CFUNC  :puts
c:0002 p:0007 s:0004 E:0008dc EVAL   D:/Programms/Ruby/Marcia/01/01.rb:1 [FINISH]
c:0001 p:0000 s:0002 E:000884 TOP    [FINISH]

D:/Programms/Ruby/Marcia/01/01.rb:1:in `<main>'
D:/Programms/Ruby/Marcia/01/01.rb:1:in `puts'
D:/Programms/Ruby/Marcia/01/01.rb:1:in `puts'
D:/Programms/Ruby/Marcia/01/01.rb:1:in `write'

-- C level backtrace information -------------------------------------------
C:\Windows\SysWOW64\ntdll.dll(ZwWaitForSingleObject+0x15) [0x77D8F8D1]
C:\Windows\syswow64\kernel32.dll(WaitForSingleObjectEx+0x43) [0x75781194]
C:\Windows\syswow64\kernel32.dll(WaitForSingleObject+0x12) [0x75781148]
C:\Ruby21\bin\msvcrt-ruby210.dll(rb_vm_bugreport+0xa7) [0x6D388C07]
C:\Ruby21\bin\msvcrt-ruby210.dll(rb_name_err_mesg_new+0x69f) [0x6D24440F]
C:\Ruby21\bin\msvcrt-ruby210.dll(rb_bug+0x2e) [0x6D2451BE]
C:\Ruby21\bin\msvcrt-ruby210.dll(rb_syserr_fail_path_in+0x41) [0x6D246AD1]
C:\Ruby21\bin\msvcrt-ruby210.dll(rb_mod_sys_fail+0x0) [0x6D246BA0]
C:\Ruby21\bin\msvcrt-ruby210.dll(rb_io_close+0x1a81) [0x6D27A061]
C:\Ruby21\bin\msvcrt-ruby210.dll(rb_vm_localjump_error+0x64f3) [0x6D37D6F3]
C:\Ruby21\bin\msvcrt-ruby210.dll(rb_funcallv+0x7e) [0x6D3836AE]
C:\Ruby21\bin\msvcrt-ruby210.dll(rb_io_puts+0x96) [0x6D276096]
C:\Ruby21\bin\msvcrt-ruby210.dll(rb_vm_localjump_error+0x64f3) [0x6D37D6F3]
C:\Ruby21\bin\msvcrt-ruby210.dll(rb_funcallv+0x7e) [0x6D3836AE]
C:\Ruby21\bin\msvcrt-ruby210.dll(rb_io_puts+0x21c) [0x6D27621C]
C:\Ruby21\bin\msvcrt-ruby210.dll(rb_error_arity+0x1c6) [0x6D373E76]
C:\Ruby21\bin\msvcrt-ruby210.dll(rb_f_send+0x648) [0x6D37F738]
C:\Ruby21\bin\msvcrt-ruby210.dll(rb_vm_localjump_error+0x1b37) [0x6D378D37]
C:\Ruby21\bin\msvcrt-ruby210.dll(rb_vm_localjump_error+0x57b1) [0x6D37C9B1]
C:\Ruby21\bin\msvcrt-ruby210.dll(rb_iseq_eval_main+0x121) [0x6D3855C1]
C:\Ruby21\bin\msvcrt-ruby210.dll(rb_check_copyable+0x3186) [0x6D24A0A6]
C:\Ruby21\bin\msvcrt-ruby210.dll(ruby_run_node+0x2d) [0x6D24D38D]
 [0x0040287F]
 [0x004013FA]
C:\Windows\syswow64\kernel32.dll(BaseThreadInitThunk+0x12) [0x757833AA]
C:\Windows\SysWOW64\ntdll.dll(RtlInitializeExceptionChain+0x63) [0x77DA9F72]

-- Other runtime information -----------------------------------------------

* Loaded script: D:/Programms/Ruby/Marcia/01/01.rb

* Loaded features:

    0 enumerator.so
    1 C:/Ruby21/lib/ruby/2.1.0/i386-mingw32/enc/encdb.so
    2 C:/Ruby21/lib/ruby/2.1.0/i386-mingw32/enc/windows_1251.so
    3 C:/Ruby21/lib/ruby/2.1.0/i386-mingw32/enc/trans/transdb.so
    4 C:/Ruby21/lib/ruby/2.1.0/i386-mingw32/rbconfig.rb
    5 C:/Ruby21/lib/ruby/2.1.0/rubygems/compatibility.rb
    6 C:/Ruby21/lib/ruby/2.1.0/rubygems/defaults.rb
    7 C:/Ruby21/lib/ruby/2.1.0/rubygems/deprecate.rb
    8 C:/Ruby21/lib/ruby/2.1.0/rubygems/errors.rb
    9 C:/Ruby21/lib/ruby/2.1.0/rubygems/version.rb
   10 C:/Ruby21/lib/ruby/2.1.0/rubygems/requirement.rb
   11 C:/Ruby21/lib/ruby/2.1.0/rubygems/platform.rb
   12 C:/Ruby21/lib/ruby/2.1.0/rubygems/basic_specification.rb
   13 C:/Ruby21/lib/ruby/2.1.0/rubygems/stub_specification.rb
   14 C:/Ruby21/lib/ruby/2.1.0/rubygems/util/stringio.rb
   15 C:/Ruby21/lib/ruby/2.1.0/rubygems/specification.rb
   16 C:/Ruby21/lib/ruby/2.1.0/rubygems/exceptions.rb
   17 C:/Ruby21/lib/ruby/2.1.0/rubygems/defaults/operating_system.rb
   18 C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_gem.rb
   19 thread.rb
   20 C:/Ruby21/lib/ruby/2.1.0/i386-mingw32/thread.so
   21 C:/Ruby21/lib/ruby/2.1.0/monitor.rb
   22 C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb
   23 C:/Ruby21/lib/ruby/2.1.0/rubygems.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html


This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

有没有办法让 ConEmu 表现得像 cmd.exe?

标准控制台的证明链接: http ://i.stack.imgur.com/NqUdM.png http://i.imgur.com/SmMImI6.png

4

1 回答 1

1

在版本 150814 中已修复的问题。

让 ConEmu 表现得像 cmd.exe 的方法?

什么?它的行为已经像 cmd.exe。不管事实如何,这都不是正确的声明

您是否在 ConEmu 之外尝试过?你正在尝试什么版本?

于 2015-08-14T12:24:22.717 回答