2013-08-27 14 views
3

我失去了對這個我的頭髮:導軌 - 在US-ASCII無效字節序列

我的Rails服務器啓動時確定,但無論它的請求時(除資產和公共內容),我得到這個錯誤:

ArgumentError in HomeController#index 

invalid byte sequence in US-ASCII 

這個框架跟蹤(無應用軌跡)

better_errors (0.9.0) lib/better_errors/stack_frame.rb:19:in `from_exception' 
better_errors (0.9.0) lib/better_errors/error_page.rb:52:in `backtrace_frames' 
better_errors (0.9.0) lib/better_errors/middleware.rb:114:in `log_exception' 
better_errors (0.9.0) lib/better_errors/middleware.rb:87:in `rescue in protected_app_call' 
better_errors (0.9.0) lib/better_errors/middleware.rb:84:in `protected_app_call' 
better_errors (0.9.0) lib/better_errors/middleware.rb:79:in `better_errors_call' 
better_errors (0.9.0) lib/better_errors/middleware.rb:56:in `call' 
actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call' 
actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call' 
railties (3.2.13) lib/rails/rack/logger.rb:32:in `call_app' 
railties (3.2.13) lib/rails/rack/logger.rb:16:in `block in call' 
activesupport (3.2.13) lib/active_support/tagged_logging.rb:22:in `tagged' 
railties (3.2.13) lib/rails/rack/logger.rb:16:in `call' 
actionpack (3.2.13) lib/action_dispatch/middleware/request_id.rb:22:in `call' 
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call' 
rack (1.4.5) lib/rack/runtime.rb:17:in `call' 
activesupport (3.2.13) lib/active_support/cache/strategy/local_cache.rb:72:in `call' 
rack (1.4.5) lib/rack/lock.rb:15:in `call' 
actionpack (3.2.13) lib/action_dispatch/middleware/static.rb:63:in `call' 
railties (3.2.13) lib/rails/engine.rb:479:in `call' 
railties (3.2.13) lib/rails/application.rb:223:in `call' 
rack (1.4.5) lib/rack/content_length.rb:14:in `call' 
railties (3.2.13) lib/rails/rack/log_tailer.rb:17:in `call' 
rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service' 
/home/augustin/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service' 
/home/augustin/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run' 
/home/augustin/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread' 

我的團隊在Windows上運行,並能正常工作的平臺上,但我在Ubuntu計算機上發生的錯誤。一切正常,直到現在,如果我回滾到我最近的提交它再次工作,所以錯誤是在合併。

的問題是:

  • 如何調試這個問題,因爲它不是真正的冗長?
  • 錯誤實際上意味着什麼? Ascii是預期的,那不是我們所擁有的,或者發現了ascii,這不是我們所期望的?
  • 在應用程序控制器中,錯誤是否更可能出現在寶石中?
  • 有沒有一種方法可以過濾所有特殊字符,以便從中獲取創意?
  • 還有什麼其他信息可以幫我調試嗎?

閱讀:

附:

Gemfile

source 'https://rubygems.org' 

gem 'rails', '3.2.13' 

# Bundle edge Rails instead: 
# gem 'rails', :git => 'git://github.com/rails/rails.git' 

# Database 
gem 'pg' 

# Database Init 
gem 'seed_dump' 
# gem "seedbank" 

# gem 'active_model_serializers' 

# HAML 
gem 'haml', '4.0.3' 
gem 'html2haml' 

# Front-end 
gem 'jquery-rails' 
gem 'bootstrap-sass', :git => 'git://github.com/thomas-mcdonald/bootstrap-sass.git', :branch => '3' 
# gem 'font-awesome-sass-rails' 
gem 'font-awesome-rails' 
gem 'bootstrap-datepicker-rails' 
gem 'jquery-tokeninput-rails' # tag and autocomplete for conversation 

# Shared mustache templates for rails 3. 
gem 'smt_rails' 

# Attachements 
gem 'paperclip', '3.4.2' 

# Share on Social Network 
gem 'social-share-button' 

# Jquery Upload File 
# gem "jquery.fileupload-rails" 
# Map 
gem 'mapbox-rails', :git => 'https://github.com/aug-riedinger/mapbox-rails.git' 
gem 'leaflet-markercluster-rails' 

# Authentication 
gem 'bcrypt-ruby', '3.0.1', :require => 'bcrypt' 
gem 'devise' 
gem 'omniauth' 
gem 'omniauth-facebook', "1.4.0" 
gem 'oauth2' 
gem 'fb_graph' 

# Gems used only for assets and not required 
# in production environments by default. 
group :assets do 
    gem 'sass-rails', '~> 3.2.3' 
    gem 'coffee-rails', '~> 3.2.1' 
    gem 'coffee-script-source', '1.5.0'  
    gem 'uglifier', '>= 1.0.3' 
end 

group :development, :test do 
    gem 'better_errors' 
    gem 'binding_of_caller' 
end 

platforms :ruby do 
    group :development, :test do 
    gem 'railroady' 
    end 
    group :production do 
    gem 'aws-sdk' 
    gem 'unicorn' 
    gem 'newrelic_rpm' 
    end 
end 

# Messaging - Notifications 
gem 'simple_form' 
gem 'mailboxer' 
gem 'pusher' 

gem 'amistad' 

# Pdf generation 
gem 'prawn' 
gem 'prawnto' 

# Payments 
gem 'activemerchant' 

# SEO 
gem 'dynamic_sitemaps' 
gem 'metamagic' 

# Static files 
gem 'markdown-rails' 

謝謝你幫助一個desesperate傢伙......

+0

http:// www。 railshorde.com/blog/invalid-byte-sequence-in-us-ascii – Animesh

回答

5

所以,我終於找到通過查看歷史記錄(git log)所有提交的解決方案,測試,最後製作git diff <commit_hash> <previous_commit_hash>,看看有什麼變化。

我曾在一個輔助的非ASCII字符(裝在每次調用顯然):

def group_currency(group) 
    currency = group.currency 
    case currency 
    when 'EUR' 
     haml_tag "€" 
    when 'USD' 
     haml_tag "$" 
    when 'GBP' 
     haml_tag "£" 
    end 

    end 

因此,在該文件的beggining添加此解決它:

#encoding: utf-8 
module GroupsHelper 
... 

但我找到更多的問題是爲什麼不能導軌定位和報告在日誌中出現問題的文件... 我在這個Rails上創建了一個問題:https://github.com/rails/rails/issues/12041

+2

我只是添加我從你的github問題中學到的東西。要找出**什麼文件**導致生產中出現run rails問題:'rails server -e production',您將得到精確的錯誤消息。 – mrt

+0

當然,或者正在運行的測試環境也能完成這項工作! –

+0

如果您不確定有問題的字符是什麼,請嘗試運行以下命令: '$ grep --color ='auto'-P -n「[\ x80- \ xFF]」/ *' – Francois

相關問題