Better percent-escape exception.

Should resolve #1510. While improving exceptions for 2.0 we may as well get as much as possible done.

For your ease, this PR is already against the 2.0 branch, so it should be an easy merge. =)