-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tolerate Unicode Escape Sequences introduced by Pact JVM #156
Comments
Reproduction Dockerfile: FROM pactfoundation/pact-cli:latest
RUN mkdir pacts
RUN wget https://raw.githubusercontent.com/pact-foundation/pact-5-minute-getting-started-guide/refs/heads/main/pacts/GettingStartedOrderWeb-GettingStartedOrderApi.json
RUN sed -i -e 's/burger/b\\uDAA5rger/g' GettingStartedOrderWeb-GettingStartedOrderApi.json
RUN mv GettingStartedOrderWeb-GettingStartedOrderApi.json ./pacts
# This will fail
CMD pact-broker publish ./pacts --consumer-app-version 1.0.0 |
To verify that the unicode escape is actually the problem, I replaced it with |
Just saw, that the pact file parsing is done in https://github.com/pact-foundation/pact_broker-client, not here, so this issue might be better off there? |
Dug a little bit further: the problem seems to be known at ruby json module, but the maintainers don't consider this sufficiently relevant to fix: ruby/json#383 |
So, after revising how UTF-16 works I think one could come to the conclusion that ruby-json (and the pact cli) is behaving as expected. |
Pre issue-raising checklist
I have already (please mark the applicable with an
x
):Software versions
Expected behaviour
The CLI is able to handle unicode escape sequences introduced by Pact JVM into example values.
Actual behaviour
Pact CLI throws error message for some escaped unicode characters.
For "\uDAA5" pact cli may throws
For others it throws the following, but I'm not sure which escape sequences are responsible for that yet (the ones mentioned in the log aren't exactly in the contract file).
Steps to reproduce
Insert "\uDAA5" into an example value in the contract and try to upload it using the pact CLI. Can provide a reproduction repo if required, "pact-ruby-standalone-e2e-example" doesn't seem to work well on windows.
Relevent log files
see above
Edit: fixed wrong usage of keyword 'surrogate' in description
The text was updated successfully, but these errors were encountered: