I am encountering an incompatible character encoding error in production. I tried to reproduce it locally but had no luck. This is the error message:
A ActionView::Template::Error occurred in controller_name#action_name:
incompatible character encodings: UTF-8 and ASCII-8BIT
activesupport (3.0.5) lib/active_support/core_ext/string/output_safety.rb:80:in `concat'
config.encoding
is already set to "utf-8" in application.rb. What's perplexing to me is that the issue persists only for some time around the Passenger restart and vanishes after some time. Further debugging into the exception backtrace gave me this:
activesupport (3.0.5) lib/active_support/core_ext/string/output_safety.rb:80:in `concat'
activesupport (3.0.5) lib/active_support/core_ext/string/output_safety.rb:80:in `concat'
actionpack (3.0.5) lib/action_view/template/handlers/erb.rb:14:in `<<'
app/views/web/controller_name/action_name.erb:98
<%currentUrl = request.url%>
Line 98: <a href="<%= raw currentUrl %>" id="xyz">
It is mentioned in "ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT)" that ActionDispatch::Request
might cause the problem, but I am clueless as to how the issue fixes itself after a while!