Skip to content
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

fix(#468): Allow non-ASCII chars on most user input #469

Closed
wants to merge 1 commit into from

Conversation

adamrodger
Copy link
Contributor

Instead of trying to marshal strings, which don't marshal nicely over the FFI boundary because C# uses UTF-16 but Rust wants UTF-8, instead explicitly convert strings to a UTF-8 byte[] and marshal those.

Some places don't need to allow non-ASCII, such as the scheme in URLs, whereas others are very tricky, such as consumer filters. This would change the API to byte[][] and those can't be marshalled, so some parts still support non-ASCII for now. If that's a problem in the future then some custom marshalling could be implemented, but currently that seems overkill.

Closes #468

Instead of trying to marshal strings, which don't marshal nicely over
the FFI boundary because C# uses UTF-16 but Rust wants UTF-8, instead
explicitly convert strings to a UTF-8 `byte[]` and marshal those.

Some places don't need to allow non-ASCII, such as the scheme in URLs,
whereas others are very tricky, such as consumer filters. This would
change the API to `byte[][]` and those can't be marshalled, so some
parts still support non-ASCII for now. If that's a problem in the future
then some custom marshalling could be implemented, but currently that
seems overkill.
@@ -71,6 +71,7 @@ public PactExtensionsTests(ITestOutputHelper output)
File.Delete("PactExtensionsTests-Consumer-V3-PactExtensionsTests-Provider.json");
File.Delete("PactExtensionsTests-Consumer-V4-PactExtensionsTests-Provider.json");
File.Delete("PactExtensionsTests-Combined-V4-PactExtensionsTests-Provider.json");
File.Delete("PactExtensio�sTests-Combined-V4-PactExtensio�sTests-Provider.json");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ñ - pretty unnoticable in Code Review :)

@adamrodger adamrodger closed this Feb 23, 2024
@adamrodger adamrodger deleted the fix/non-ascii-chars branch February 23, 2024 17:10
@adamrodger
Copy link
Contributor Author

This is no longer compatible with PactNet 5.x and an alternative fix will be created instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using signs outside ASCII in response body
2 participants