This project is archived and is in readonly mode.
json encoding systax error
-
Ryan Bigg
Please provide steps to reproduce this, most helpful would be a failing test case in the form of a patch. Please see the contributors guide.
-
Will Sargent
You can reproduce this bug by typing 'rails generate --help' at the console.
/opt/local/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in
polyglot_original_require': /Users/wsargent/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/json/encoding.rb:107: syntax error, unexpected kUNDEF (SyntaxError) ...ncode(::Encoding::UTF_8, undef: :replace).force_encoding(::E...^ from /opt/local/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require' from /Users/wsargent/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/json.rb:2 from /opt/local/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `polyglot_original_require' from /opt/local/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require' from /Users/wsargent/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_view/helpers/prototype_helper.rb:2 from /Users/wsargent/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_view/helpers/javascript_helper.rb:37 from /opt/local/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `polyglot_original_require' from /opt/local/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require' from /Users/wsargent/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_view/helpers/url_helper.rb:1 from /Users/wsargent/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_view/helpers/form_tag_helper.rb:16 from /opt/local/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `polyglot_original_require' from /opt/local/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require' from /Users/wsargent/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_view/helpers/form_helper.rb:4 from /opt/local/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `polyglot_original_require' from /opt/local/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require' from /Users/wsargent/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_view/helpers/active_model_helper.rb:1 from /Users/wsargent/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_view/helpers.rb:39 from /Users/wsargent/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_view/base.rb:160 from /Users/wsargent/.bundle/ruby/1.8/gems/haml-2.2.23/lib/haml/helpers/action_view_mods.rb:2 from /opt/local/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `polyglot_original_require' from /opt/local/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require' from /Users/wsargent/.bundle/ruby/1.8/gems/haml-2.2.23/lib/haml/helpers.rb:2 from /opt/local/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `polyglot_original_require' from /opt/local/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require' from /Users/wsargent/.bundle/ruby/1.8/gems/haml-2.2.23/lib/haml/engine.rb:1 from /opt/local/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `polyglot_original_require' from /opt/local/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require' from /Users/wsargent/.bundle/ruby/1.8/gems/haml-2.2.23/lib/haml.rb:40 from /opt/local/lib/ruby/gems/1.8/gems/bundler-0.9.21/lib/bundler/runtime.rb:48:in `require' from /opt/local/lib/ruby/gems/1.8/gems/bundler-0.9.21/lib/bundler/runtime.rb:48:in `require' from /opt/local/lib/ruby/gems/1.8/gems/bundler-0.9.21/lib/bundler/runtime.rb:43:in `each' from /opt/local/lib/ruby/gems/1.8/gems/bundler-0.9.21/lib/bundler/runtime.rb:43:in `require' from /opt/local/lib/ruby/gems/1.8/gems/bundler-0.9.21/lib/bundler/runtime.rb:42:in `each' from /opt/local/lib/ruby/gems/1.8/gems/bundler-0.9.21/lib/bundler/runtime.rb:42:in `require' from /opt/local/lib/ruby/gems/1.8/gems/bundler-0.9.21/lib/bundler.rb:93:in `require' -
Will Sargent
It should be:
string = string.encode(::Encoding::UTF_8, :undef => :replace).force_encoding(::Encoding::BINARY) -
Ryan Bigg
- State changed from new to needs-more-info
Please formulate a patch and attach it to this ticket.
-
James Sadler
Patch attached.
-
Ryan Bigg
- State changed from needs-more-info to open
Patch applies cleanly and fixes this for Ruby versions < 1.9.
+1
-
Santiago Pastorino
This was fixed by 1d63129eff1e25dd22e182cdef40ec61bf5dde88
-
Ryan Bigg
- State changed from open to committed
Fixed by Xavier Noria in
1d63129eff1e25dd22e182cdef40ec61bf5dde88:use ordinary syntax for options to be well-formed in 1.8
