简体   繁体   English

为什么我的Sproutcore开发服务器断开连接“US-ASCII中的无效字节序列”?

[英]Why does my Sproutcore development server drop connections with “invalid byte sequence in US-ASCII”?

Here's the stack: Sproutcore 1.0.1046. 这是堆栈:Sproutcore 1.0.1046。 Ruby 1.9.1, in RVM. Ruby 1.9.1,在RVM中。 Thin 1.2.7. 薄1.2.7。 Thor 0.13.8. 托尔0.13.8。 Rack 1.2.1. 机架1.2.1。 Eventmachine 0.12.10. Eventmachine 0.12.10。 Erubis 2.6.6. Erubis 2.6.6。

When I start the sc-server on any application, my first request to this server produces this in the console log: 当我在任何应用程序上启动sc-server时,我对该服务器的第一个请求会在控制台日志中生成:

ArgumentError: invalid byte sequence in US-ASCII

...followed by this stack trace . ......然后是这个堆栈跟踪 (I've listed gems which appear in the stack trace above, but there's a complete gemset list in the same gist as the stack trace.) (我列出了出现在上面的堆栈跟踪中的宝石,但是在堆栈跟踪的同一个gist中有一个完整的gemset列表。)

Research on the error message points out that this is a common problem with Ruby 1.9, but the stack trace suggests that the problem is in one of the gems somewhere. 对错误消息的研究指出这是Ruby 1.9的一个常见问题,但堆栈跟踪表明问题出现在其中一个宝石中。

I have: 我有:

  • Upgraded my OS (Mac OS X 10.5 to 10.6) in order to get the latest gcc Apple provides. 升级我的操作系统(Mac OS X 10.5到10.6)以获得Apple提供的最新gcc
  • Reinstalled RVM. 重新安装RVM。
  • Reinstalled Ruby. 重新安装Ruby。
  • Reinstalled all the relevant gems. 重新安装了所有相关的宝石。

And yet I still have this problem on one system, but not on another. 然而,我仍然在一个系统上有这个问题,但在另一个系统上没有。 (NB there are several devs working on this code, and I'm the only one seeing this problem. I'm 99% certain it's not our code.) I guess what I'm saying is that I've cleared and rebuilt a lot of gems to try to isolate or remove this glitch, and yet I still haven't gotten rid of it. (注意,有几个开发人员正在研究这个代码,我是唯一一个看到这个问题的人。我99%肯定这不是我们的代码。)我想我说的是我清理并重建了一个很多宝石试图隔离或消除这个故障,但我仍然没有摆脱它。

Where should I look next? 我应该在哪里看下一个?

你的bash环境中有一些特殊设置,设置ruby使用US-ASCII,这发生在我试图从远程终端执行sc-server时...我不确定它是什么,但它没有'使用UTF-8,当它遇到麻烦时。

您也可以更改Encoding.default_external

Thanks so much for the Encoding.default_external suggestion. 非常感谢Encoding.default_external建议。 I was having the same problem, despite correctly set magic comments and environment variables. 尽管正确设置了魔术评论和环境变量,但我遇到了同样的问题。 In Rails 2.3.9 I added this before_filter in application_controller.rb, resolved the issue: 在Rails 2.3.9中,我在application_controller.rb中添加了这个before_filter,解决了这个问题:

def set_encoding
  Encoding.default_external = 'UTF-8'
end

I had the same issue with RSS Feeds that I was displaying in a Rails 2.3.8 app with Ruby 1.9.2. 我在使用Ruby 1.9.2的Rails 2.3.8应用程序中显示的RSS Feeds遇到了同样的问题。 My issue wasn't solved by the application_controller.rb before_filter technique mentioned here. 我的问题没有通过这里提到的application_controller.rb before_filter技术解决。 The fix was to put the following into "RAILS_ROOT/config/initializers/string_encodings.rb": 修复是将以下内容放入“RAILS_ROOT / config / initializers / string_encodings.rb”:

Encoding.default_external = 'UTF-8' Encoding.default_external ='UTF-8'

That worked for me site-wide, instead of on a controller level. 这对我来说在整个站点都有效,而不是在控制器级别。

In my case the ArgumentError occurred during a Capistrano deploy call that envolves ruby's net-ssh (ruby 1.9.2p290, net-ssh 2.3.0). 在我的情况下,ArgumentError在Capistrano部署调用期间发生,该调用包含ruby的net-ssh(ruby 1.9.2p290,net-ssh 2.3.0)。 None of the solutions afore mentioned worked and none of the other reasons I've read about so far: ie "strange character in key file", etc.. 上面提到的解决方案都没有起作用,也没有我到目前为止所读到的其他原因:即“密钥文件中的奇怪字符”等。

Finally, I found a none ASCII-character in a comment(!) line in my ASCII encoded ~/.ssh/config file. 最后,我在ASCII编码的〜/ .ssh / config文件中的注释(!)行中找到了一个无ASCII字符。 BINGO! 答对了!

暂无
暂无

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

相关问题 在 US-ASCII 中拆分无效字节序列 - Split invalid byte sequence in US-ASCII US-ASCII(ArgumentError)中的字节序列无效,没有任何帮助 - invalid byte sequence in US-ASCII (ArgumentError), nothing helps erubis:`scan':US-ASCII中无效的字节序列(ArgumentError) - erubis: `scan': invalid byte sequence in US-ASCII (ArgumentError) ArgumentError(US-ASCII中无效的字节序列):在ruby升级1.9.3中 - ArgumentError (invalid byte sequence in US-ASCII): in ruby upgrade 1.9.3 rake任务因US-ASCII中的无效字节序列而失败 - rake tasks fail with invalid byte sequence in US-ASCII 为什么在ruby 2.0中出现“ ArgumentError-US-ASCII中的无效字节序列” - Why do I get “ArgumentError - invalid byte sequence in US-ASCII” in ruby 2.0 在Linux Docker容器上运行时gsub编码错误US-ASCII中的无效字节序列 - gsub encoding error when running on Linux Docker Container Invalid byte sequence in US-ASCII 将Ruby升级到1.9.2后,Rails查看错误“US-ASCII中的无效字节序列”错误 - Rails view error “invalid byte sequence in US-ASCII” error after upgrading Ruby to 1.9.2 ArgumentError:当我运行 bundle exec rake [on hold] 时,US-ASCII 中的字节序列无效(参数错误) - ArgumentError: invalid byte sequence in US-ASCII (Argument Error) when I run bundle exec rake [on hold] 当我尝试在Ramaze和Ruby 1.9中上载文件时,出现“ US-ASCII中无效的字节序列” - Getting “invalid byte sequence in US-ASCII” when I try to upload a file in Ramaze and Ruby 1.9
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM