handling xml with quotes escaped
Right now if the xml has quotes that are preceded with backslashes, the site does not recognize it as xml.
I am debugging code in ruby and when I do an xml request, the response is in this form
"<?xml version="1.0" encoding="UTF-8" standalone="yes"?><response><feedMessageResponse><count>51</count><feed><id>0RWqSn8iuUFnoShnsm7Fjh2LaUslTu2nI</id><name>location</name><description>location</description><status>ACTIVE</status><usage>0</usage
It would be good for the site to detect this and convert it to normal text (replace \ā to just ā and remove initial and ending quotes.
Right now is have to do āputs variable_with_xmlā and then cut and paste that into the site.
Log in to comment and vote
Comments5
@levelsio
Nov 29, 2024
Hmm, no XML viewer online would accept that as valid XML though, so I not sure I wanna do this
Purple Blueberry
Nov 29, 2024
Itās definitely not valid xml but itās common to get strings back like this in most programming languages when you are in the debugger. It would just allow someone to cut and paste into json.pub without having to run it through a utility function. In ruby you currently have to do āputs xml_strungā and then cut and paste that into JSON.pub. Same is true with any string that has a ācharacter in it. Itās called escaped strings.
Part of the reason Iām asking for this desire is that the idea is that json.pub is supposed to be better than the other tools
My idea is you do a quick check to see if the string is escaped. If it is, then you either just convert it for the user (as it isnāt valid in its current format) or maybe ask a ser if they want the string in-escaped (although feel answer will always be yes).
Anyways under itās your app so respect whatever your final decision is
@levelsio
Nov 29, 2024
True good point. So maybe we can check if itās ādataā and then remove the ā
Is it always ā?
@levelsio
Nov 29, 2024
Added now for you, let me know if it works!
Purple Blueberry
Nov 30, 2024
Works for me. Awesome & thanks!