I have semicolon as query string separator in my urls instead of and (&). My problem is that when I try to do a meta refresh to a url with semicolon in query string it will translate it to %253b instead. So when forwarded, I can't read the query string parameters as the separator is not there anymore. example:
How can I solve this, so it doesn't translate the semicolon when doing a meta refresh?
Grateful for any help!
The problem is that the query string is being encoded twice, when it needn’t be encoded at all. This is probably because the code that encodes and decodes the query string (which you don’t mention) is expecting the traditional ampersand (&) query string separator and feels free to encode everything else.
1st encoding (semicolon → %3B):
2nd encoding (percent → %25):
As pointed in the comments,
; is a valid character for an url which is reserved for a purpose not specified in the RFC. Like pointed by danorton in its own answer, the problem seems to be a double encoding of the URL.
As it is, it is impossible to provide a solution without more information about the environment and the exact situation when the problem occurs.
However, like stated in my previous wrong answer, I stay on my position concerning the use of
& as a separator. Using something else is asking for problems in my opinion.
my "wrong" answer
I don't think ; is a valid character for an url, so it seems normal to me that it get encoded. There's a reason & is used, why do you want to change that ?
Doing something like this is asking for problems. It's already pretty hard to get things working on all the browsers and OSes combination, why makes things even harder ?
Using single quotes for the url will fix the issue.
<meta http-equiv="refresh" content="0;URL='http://domain.com/?foo=1;bar=2'">
Most browsers (Firefox, Chrome, Safari, Opera) will probably redirect to the full url atm without the quotes, but Internet Explorer (IE10 too) will discard the part after the second semicolon without the single quotes.<hr>
Uri Syntax RFC3986
<li>Semicolon as separator: http://tools.ietf.org/html/rfc3986#section-3.3</li>
Reserved characters: http://tools.ietf.org/html/rfc3986#appendix-A
: / ? # [ ] @ ! $ & ' ( ) * + , ; =
<li>Using meta refresh: http://www.w3.org/TR/WCAG20-TECHS/H76.html</li>
<li>";" instead of "&": http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2</li>