-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
encoding of special characters is not consistent across ruby versions #41
Comments
Ouch, that's a painful bug. Thank you so much for investigating this issue so thoroughly and explaining it so succinctly, @keiths-osc ! I'd rather not drop support for ruby 1.9.3 yet (it's not close to End of Life yet), so is there a better workaround than switching on |
@tjarrat, I've been giving your question (and this issue in general) some more thought. There is something else I noticed. When producing xml with attributes, I noticed that the special characters are handled consistently across ruby versions: This script
outputs this on 1.9.3
and this on 2.0
In the
I get this on 1.9.3:
and this on 2.0:
I wonder if the best bet would be for gyoku to encode the special characters for element values in the exact same way builder does (perhaps by directly using the The results are consistent across Ruby versions, and my gut feeling is that the Builder way of handling the encoding for XML is maybe more correct than what |
Sorry I've been so quiet lately --- I'm going to need some time to think about this and explore the ramifications of that change. I think we'd need some stronger integration tests further upstream in With ruby 1.9.3 reaching EOL in a few months I wonder how that affects this issue. We could keep the behavior from 1.9.3, but anyone relying on the new behavior would be very surprised (to say the least). |
Consider the following ruby script:
When executed on Ruby 1.9.3, it produces this output:
When executed on Ruby 2.0.0, it produces this output:
The apostrophe character is not encoded at all on Ruby 1.9.3, but on ruby 2.0 it is converted to
'
. The reason appears to be because of this line. The behavior of theCGI.escapeHTML
function seems to have changed from Ruby 1.9.3 to Ruby 2.0. Here is an example.This script:
produces this output on Ruby 1.9.3:
but this output on Ruby 2.0:
It seems like the output should not change depending on the ruby version. In addition, if an apostrophe is going to be encoded, it seems like it would be more correct to encode it as
'
instead of'
. In fact, encoding it as'
is directly causing me a problem here. :)The text was updated successfully, but these errors were encountered: