我正在使用Rails 4.2.0和Rubinius 2.4.1,在带有RVM的OSX 10.10上安装。
但是当我在rails控制台puts 'é'
中写道时,我得到以下恶意错误列表:
An exception occurred running bin/rails:
"\xC3" to UTF-8 in conversion from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
Backtrace:
String#encode! at kernel/common/string.rb:946
IO(File)#write at kernel/common/io.rb:2401
{ } in IO(File)#puts at kernel/common/io.rb:1796
Array#each at kernel/bootstrap/array.rb:76
IO(File)#puts at kernel/common/io.rb:1780
Pry::History#save_to_file at /Users/hassen/.rvm/gems/rbx-2.4.1/gems/pry-0.10.1/lib/pry/history.rb:106
Method#call at kernel/common/method.rb:71
Pry::History#<< (push) at /Users/hassen/.rvm/gems/rbx-2.4.1/gems/pry-0.10.1/lib/pry/history.rb:50
Pry#handle_line at /Users/hassen/.rvm/gems/rbx-2.4.1/gems/pry-0.10.1/lib/pry/pry_instance.rb:267
{ } in Pry#eval at /Users/hassen/.rvm/gems/rbx-2.4.1/gems/pry-0.10.1/lib/pry/pry_instance.rb:243
Proc#call at kernel/bootstrap/proc.rb:20
{ } in Kernel(Pry)#catch at kernel/common/throw_catch.rb:30
Rubinius::ThrownValue.register at kernel/common/throw_catch.rb:8
Kernel(Pry)#catch at kernel/common/throw_catch.rb:29
{ } in Pry#eval at /Users/hassen/.rvm/gems/rbx-2.4.1/gems/pry-0.10.1/lib/pry/pry_instance.rb:242
Proc#call at kernel/bootstrap/proc.rb:20
{ } in Kernel(Pry)#catch at kernel/common/throw_catch.rb:30
Rubinius::ThrownValue.register at kernel/common/throw_catch.rb:8
Kernel(Pry)#catch at kernel/common/throw_catch.rb:29
Pry#eval at /Users/hassen/.rvm/gems/rbx-2.4.1/gems/pry-0.10.1/lib/pry/pry_instance.rb:241
{ } in Pry::REPL#repl at /Users/hassen/.rvm/gems/rbx-2.4.1/gems/pry-0.10.1/lib/pry/repl.rb:77
Kernel(Pry::REPL)#loop at kernel/common/kernel.rb:510
Pry::REPL#repl at /Users/hassen/.rvm/gems/rbx-2.4.1/gems/pry-0.10.1/lib/pry/repl.rb:67
{ } in Pry::REPL#start at /Users/hassen/.rvm/gems/rbx-2.4.1/gems/pry-0.10.1/lib/pry/repl.rb:38
Proc#call at kernel/bootstrap/proc.rb:20
Pry::InputLock#__with_ownership at /Users/hassen/.rvm/gems/rbx-2.4.1/gems/pry-0.10.1/lib/pry/input_lock.rb:61
Pry::InputLock#with_ownership at /Users/hassen/.rvm/gems/rbx-2.4.1/gems/pry-0.10.1/lib/pry/input_lock.rb:79
Pry::REPL#start at /Users/hassen/.rvm/gems/rbx-2.4.1/gems/pry-0.10.1/lib/pry/repl.rb:38
Pry::REPL.start at /Users/hassen/.rvm/gems/rbx-2.4.1/gems/pry-0.10.1/lib/pry/repl.rb:15
Pry.start at /Users/hassen/.rvm/gems/rbx-2.4.1/gems/pry-0.10.1/lib/pry/pry_class.rb:169
Rails::Console#start at /Users/hassen/.rvm/gems/rbx-2.4.1/gems/railties-4.2.0/lib/rails/commands/console.rb:110
Rails::Console.start at /Users/hassen/.rvm/gems/rbx-2.4.1/gems/railties-4.2.0/lib/rails/commands/console.rb:9
Rails::CommandsTasks#console at /Users/hassen/.rvm/gems/rbx-2.4.1/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:68
Rails::CommandsTasks#run_command! at /Users/hassen/.rvm/gems/rbx-2.4.1/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39
Object#__script__ at /Users/hassen/.rvm/gems/rbx-2.4.1/gems/railties-4.2.0/lib/rails/commands.rb:17
Rubinius::CodeLoader.require at kernel/common/code_loader.rb:247
Kernel(Object)#require at kernel/common/kernel.rb:755
Object#__script__ at bin/rails:4
Rubinius::CodeLoader#load_script at kernel/delta/code_loader.rb:66
Rubinius::CodeLoader.load_script at kernel/delta/code_loader.rb:152
Rubinius::Loader#script at kernel/loader.rb:645
Rubinius::Loader#main at kernel/loader.rb:799
似乎 UTF_8 编码存在问题,但未找到解决此问题的方法。你有好主意吗?感谢。