All,
I posted this in Rails Talk, and other people have the same issue:
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/2c13ad7c0f8c0781/a643a146d8a5645b?lnk=gst&q=to_xml#a643a146d8a5645b
Currently, to_xml will automatically escape any entities into their
corresponding &XXX representation. There''s a piece in the
documentation that says "If $KCODE is set to ''u'' and
encoding set to
''UTF8'', then escaping will NOT be performed."
Unfortunately, this doesn''t appear to be the case. Even after
following the docs and ensuring that default_charset is indeed UTF-8
(actually the default for Rails nowadays), we still get encoded
characters in to_xml output.
Since our client is UTF-8 aware, we need to pass thru the UTF-8 data
intact. The escaping actually causes client problems. The only way
we''ve found to do this is with the following horrible monkey-patch:
module Builder
class XmlBase
def _escape(text)
text
end
end
end
Any ideas on a proper patch? I''m willing to work on it (already
working on another patch for timezone stuff with Geoff anyways)
Thanks,
Nate
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---
Michael Koziarski
2008-Oct-26 18:18 UTC
Re: No way to override default to_xml escaping behavior
> Any ideas on a proper patch? I''m willing to work on it (already > working on another patch for timezone stuff with Geoff anyways)Seems that the fix you have found indicates it''s a problem with the builder library more than our own code in to_xml? Also, what client parser are you using that doesn''t know how to normalise those entity references, I believe it''s required to be considered a ''compliant'' parser? -- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---