A query string such as edit[field_project][widget][0][target_id]=123 gets changed to ?edit%5Bfield_project%5D%5Bwidget%5D%5B0%5D%5Btarget_id%5D=123 on output.
This is a problem when used in conjunction with modules like prepopulate which expect field structure to be passed in the query string.
Comments
Comment #2
laboratory.mikeOK, I've tried making the following view, and I cannot reproduce the character encoding issue. I've added the configuration below. If you could, please send me the modules and configuration of the view, so I can get an idea of how you are building the URL.
Comment #3
jason.bell commentedI have not experienced this with a single query string, but when trying to add multiples joined by an ampersand.
Update the above to
query_string: 'edit[body][0][value]=123&plan=181', and it becomesedit[body][0][value]=123&%3Bplan=181and does not work. Firefox leaves the first string alone and converts the ampersand to HTML entity, Chrome converts all of the punctuation characters.Comment #4
laboratory.mike@jason.bell, thanks for the insight. I'll try out that case.
Comment #5
laboratory.mikeI am adding a "Browser compatibility" tag to this, as its working fine for me in Firefox, even with something complex like this:
However, This does not work at all in Chrome. I'll see what I need to do to encode correctly.
Comment #7
laboratory.mikeOK, figured it out. I needed to change how rendering works for the module (namely, the link has to be converted to a markup and string replacement performed), and I added bracket replacement only. We could do other characters, but I do not want to open it up to conversion of any character, to prevent from malicious characters being decoded.
The issue was, I was returning a render array for the link, and during conversion it appears that certain browsers encode the HTML entities in a query string. By returning a markup, I can enforce encoding of brackets.
Also, I tested the prefix/suffix HTML, and these are working the same as before.
Comment #9
socialnicheguru commented@laboratory.mike, how did you fix? version 1.8 does not have the fix above.