I have a link similar to this (it's a little ugly because it's a URL)
<a href="/items?fc%5B%5D=12345&fc%5B%5D=56789&utf8=%E2%9C%93">foo</a>
To be a little understandable, it is encoded by a URL and converted to
<a href="/items?fc[]=12345&fc[]=56789&utf8=β">foo</a>
When the form submits, the destination URL looks different in different browsers:
In Firefox, it looks like the one you want:
http://mydomain/items?fc[]=12345&fc[]=56789&utf8=β
In Chrome, square brackets are shown URL-encoded (which gives very ugly and unprofessional looking addresses when using many of them).
http://mydomain/items?fc%5B%5D=12345&fc%5B%5D=56789&utf8=β
In IE9 (and later), everything is displayed in URL encoding:
http://mydomain/items?fc%5B%5D=12345&fc%5B%5D=56789&utf8=%E2%9C%93
I can live with the "utf8 = ..." part, since this is only a problem in IE. But none of the browsers have processing problems when the square brackets are explicitly entered in the URL, so I donβt understand why Chrome and IE, but Firefox should not show the brackets with URL encoding.
Since the html form code is the same in all browsers, I believe this is related to browsers, not the site (in this case, the Ruby on Rails site)
EDIT: Therefore, to clarify my current questions: Why is this different? Is there any way to make it look good, at least in Chrome? This might be an ugly fix, rather than URL escaping in href = "...", but I suppose this contradicts URL encoding rules?
html cross-browser url escaping
foolo
source share