Might it make more sense to just URI encode the whole thing, rather than special-case parentheses?