Skip to main content

Exception ArgumentError in PhusionPassenger::Rack::ApplicationSpawner (invalid byte sequence in UTF-8)

I’ve got this error in redmine after upgrading to ruby 1.9.


[ pid=17020 thr=20031940 file=utils.rb:176 time=2012-09-07 01:42:47.904 ]: *** Exception ArgumentError in PhusionPassenger::Rack::ApplicationSpawner (invalid byte sequence in UTF-8) (process 17020, thread #<Thread:0x00000002635388>):
	from /var/www/redmine/vendor/bundle/ruby/1.9.1/gems/shared-mime-info-0.1/lib/shared-mime-info.rb:346:in `block (2 levels) in load_magic'
	from /var/www/redmine/vendor/bundle/ruby/1.9.1/gems/shared-mime-info-0.1/lib/shared-mime-info.rb:345:in `each'
	from /var/www/redmine/vendor/bundle/ruby/1.9.1/gems/shared-mime-info-0.1/lib/shared-mime-info.rb:345:in `block in load_magic'
	from /var/www/redmine/vendor/bundle/ruby/1.9.1/gems/shared-mime-info-0.1/lib/shared-mime-info.rb:337:in `open'
	from /var/www/redmine/vendor/bundle/ruby/1.9.1/gems/shared-mime-info-0.1/lib/shared-mime-info.rb:337:in `load_magic'
	from /var/www/redmine/vendor/bundle/ruby/1.9.1/gems/shared-mime-info-0.1/lib/shared-mime-info.rb:377:in `block in <module:MIME>'
	from /var/www/redmine/vendor/bundle/ruby/1.9.1/gems/shared-mime-info-0.1/lib/shared-mime-info.rb:372:in `each'

To solve this error edit shared-mime-info.rb file (shared-mime-info gem) and change the line open(file) in load_magic method:

336  def load_magic(file)
337        open(file) { |f|

with this:

336     def load_magic(file)
337        open(file,  'r:ASCII-8BIT') { |f|

restart web server that is all.

One thought to “Exception ArgumentError in PhusionPassenger::Rack::ApplicationSpawner (invalid byte sequence in UTF-8)”

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.