Backport URL encoding fixes to stable7