简体   繁体   English

ArgumentError:UTF-8 中的字节序列无效

[英]ArgumentError: invalid byte sequence in UTF-8

I am new to rails, I am using rails 3.2.3 in windows7.我是 rails 新手,我在 windows7 中使用 rails 3.2.3。 I have a project in rails when i run bundle install it was successful.当我运行 bundle install 时,我在 rails 中有一个项目,它成功了。 And the rails server also working good.而且 rails 服务器也运行良好。 When i give localhost:3000 it throws an error like this,当我给 localhost:3000 时,它会抛出这样的错误,

 ERROR ArgumentError: invalid byte sequence in UTF-8
    c:/Ruby193/lib/ruby/gems/1.9.1/gems/win32console-1.3.2-x86-mingw32/lib/Win32/Console/ANSI.rb:163:in `sub!'
    c:/Ruby193/lib/ruby/gems/1.9.1/gems/win32console-1.3.2-x86-mingw32/lib/Win32/Console/ANSI.rb:163:in `_PrintString'
    c:/Ruby193/lib/ruby/gems/1.9.1/gems/win32console-1.3.2-x86-mingw32/lib/Win32/Console/ANSI.rb:146:in `block in write'
    c:/Ruby193/lib/ruby/gems/1.9.1/gems/win32console-1.3.2-x86-mingw32/lib/Win32/Console/ANSI.rb:146:in `each'
    c:/Ruby193/lib/ruby/gems/1.9.1/gems/win32console-1.3.2-x86-mingw32/lib/Win32/Console/ANSI.rb:146:in `write'
    c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/rack/log_tailer.rb:29:in `print'
    c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/rack/log_tailer.rb:29:in `tail!'
    c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/rack/log_tailer.rb:18:in `call'
    c:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/handler/webrick.rb:59:in `service'
    c:/Ruby193/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
    c:/Ruby193/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
    c:/Ruby193/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

i am unable to figure out where the exact problem.我无法弄清楚确切的问题在哪里。 I searched in google but no relevent solution.我在谷歌搜索但没有相关的解决方案。 Can anyone help me.谁能帮我。

May you have latin chars (á,é,í,ó,ú,ñ) in view messages, sometimes you can generate invalid chars when you copy the code between different Operating Systems.可能您在视图消息中有拉丁字符 (á,é,í,ó,ú,ñ),有时在不同操作系统之间复制代码时可能会生成无效字符。

Try to review view files looking for special chars and try to remove them in order to avoid this error.尝试查看查看特殊字符的视图文件并尝试删除它们以避免此错误。

I had this issue because of the spaces before each command in the fastfile .由于fastfile每个命令之前的空格,我遇到了这个问题。 The commands under each lane must be indented inwards by a space.每个通道下的命令必须向内缩进一个空格。

  lane :beta do
   gradle(task: 'assemble')  #correct (one space)

    gradle(task: 'assemble') #incorrect (many spaces)
  end

Try using a more modern rack server like Thin尝试使用更现代的机架式服务器,如Thin

Gemfile:宝石档案:

gem 'thin'

Console, run:控制台,运行:

$ bundle
$ rails s

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM