Reputation: 681
We recently moved to rails 3.2.13. We use ActiveResource to call a web service. ActiveResoure will generate the xml payload. We noticed that the new xml doesn't escape unicode character. For example:
<name> C:\Documents and Settings\All Users\testütestdev1.txt </name>
In rails 2.3, it will escape ü to ü :
<name> C:\Documents and Settings\All Users\testütestdev1.txt <name>
After some investigation. It looks like it is due to ActiveSuppport to_xml method which doesn't escape unicode character. Has anyone had this issue and know how to solve it?
Upvotes: 0
Views: 234
Reputation: 9018
You could use Rack::Utils
for that
> Rack::Utils.escape(" <name> C:\Documents and Settings\All Users\testütestdev1.txt </name>")
#=> "++%3Cname%3E+C%3ADocuments+and+SettingsAll+Users%09est%C3%BCtestdev1.txt+%3C%2Fname%3E"
> Rack::Utils.unescape(_)
#=> " <name> C:Documents and SettingsAll Users\testütestdev1.txt </name>"
Upvotes: 1