Using StimulusReflex in my app caused ActiveSupport::Inflector.transliterate to throw a strange error:
StimulusReflex::Channel Failed to re-render http://localhost:3000/Buy Can not transliterate strings with ASCII-8BIT encoding .../activesupport-6.0.3/lib/active_support/inflector/transliterate.rb:67:in `transliterate'
I changed this line to return the full stack trace, instead of just the first line (maybe it would be nice to make this configurable for debugging purposes?). After which I found the origin of the error – the following code I had in a helper method: action_name.parameterize.
Basically the string returned by action_name changes its encoding between the initial request and the stimulus reflex morphing. I'm guessing this is due to the way the controller is called, or perhaps it's really a bug in Rails?
This actually led me to realize that I don't need the .parameterize, but I wanted to submit this bug report in any case, as it might cause other unforeseen bugs down the road?
Describe the bug
The encoding of the string returned by action_name (possibly others as well) changes from UTF-8 to ASCII-8BIT between the initial request and the stimulus reflex morph.
Bug Report
Using
StimulusReflex
in my app causedActiveSupport::Inflector.transliterate
to throw a strange error:I changed this line to return the full stack trace, instead of just the first line (maybe it would be nice to make this configurable for debugging purposes?). After which I found the origin of the error – the following code I had in a helper method:
action_name.parameterize
.Basically the string returned by
action_name
changes its encoding between the initial request and the stimulus reflex morphing. I'm guessing this is due to the way the controller is called, or perhaps it's really a bug in Rails?This actually led me to realize that I don't need the
.parameterize
, but I wanted to submit this bug report in any case, as it might cause other unforeseen bugs down the road?Describe the bug
The encoding of the string returned by
action_name
(possibly others as well) changes fromUTF-8
toASCII-8BIT
between the initial request and the stimulus reflex morph.To Reproduce
Using the TodoMVC
<%= action_name.encoding %>
to the beginning of the<body>
tag inapp/views/layouts/application.html.erb
UTF-8
ASCII-8BIT
Expected behavior
The encoding should ideally stay the same (UTF-8) between requests.
Versions
StimulusReflex
External tools