Currently the code is not UTF8 safe, so we need to return a clear error when invalid characters are passed in. This also adds tests for the routes to confirm that an error is correctly returned. (cherry picked from commit 74f5def3d4)
74f5def3d4