fix CGI escaping

The prior PR (https://github.com/fog/fog/pull/3144) ended up causing some travis failures that we were unaware of. We're still testing the effect of this PR's change on our system, but it at least moves the escaping to a more appropriate place and allows the failing signaturev4 tests to pass.