jorgemanrubia / turbolinks_render

Support for `render` with Turbolinks in Rails controllers
MIT License
167 stars 16 forks source link

Error: incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string) #32

Open martinadamek opened 4 years ago

martinadamek commented 4 years ago

Hi, first of all thanks for the library and explanatory blogpost. I am trying it with my app and seeing this trace in console. Any idea, where to look at to find out what's going on? Using turbolinks_render (0.9.20).

8:24:31 AM web.1 | 2020-05-25 08:24:31 +0200: Rack app error handling request { POST /users } 8:24:31 AM web.1 | #<Encoding::CompatibilityError: incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string)> 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/actionview-6.0.3.1/lib/action_view/helpers/javascript_helper.rb:34:ingsub' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/actionview-6.0.3.1/lib/action_view/helpers/javascript_helper.rb:34:in escape_javascript' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/turbolinks_render-0.9.20/lib/turbolinks_render/middleware.rb:46:injs_code_to_render_html' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/turbolinks_render-0.9.20/lib/turbolinks_render/middleware.rb:23:in turbolinks_body' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/turbolinks_render-0.9.20/lib/turbolinks_render/middleware.rb:87:incall' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.1/lib/rails/rack/logger.rb:37:in call_app' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.1/lib/rails/rack/logger.rb:26:inblock in call' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.1/lib/active_support/tagged_logging.rb:80:in block in tagged' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.1/lib/active_support/tagged_logging.rb:28:intagged' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.1/lib/active_support/tagged_logging.rb:80:in tagged' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.1/lib/rails/rack/logger.rb:26:incall' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in call' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/remote_ip.rb:81:incall' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/request_id.rb:27:in call' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rack-2.2.2/lib/rack/method_override.rb:24:incall' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rack-2.2.2/lib/rack/runtime.rb:22:in call' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:incall' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/executor.rb:14:in call' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/static.rb:126:incall' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rack-2.2.2/lib/rack/sendfile.rb:110:in call' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/host_authorization.rb:82:incall' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/webpacker-5.1.1/lib/webpacker/dev_server_proxy.rb:25:in perform_request' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rack-proxy-0.6.5/lib/rack/proxy.rb:57:incall' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.1/lib/rails/engine.rb:527:in call' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/puma-4.3.5/lib/puma/configuration.rb:228:incall' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/puma-4.3.5/lib/puma/server.rb:713:in handle_request' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/puma-4.3.5/lib/puma/server.rb:472:inprocess_client' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/puma-4.3.5/lib/puma/server.rb:328:in block in run' 8:24:31 AM web.1 | /Users/martin/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/puma-4.3.5/lib/puma/thread_pool.rb:134:inblock in spawn_thread' `

martinadamek commented 4 years ago

I have found that the problem on my side was gzip compression of the served content: config.middleware.use(Rack::Deflater) Some more info at https://thoughtbot.com/blog/content-compression-with-rack-deflater

martinadamek commented 4 years ago

Other usages of Turbolinks worked without a problem, so not sure this is problem in turbolinks_render yet.