Skip to content

Conversation

@ajgolledge
Copy link

Parse responses encoded in multibyte character sets (e.g. UTF-8) correctly by applying the content length given in the response to the length of the raw byte array and not the encoded string. The length of the string and the length of the byte array are not necessarily equivalent.

@ajgolledge ajgolledge mentioned this pull request May 9, 2023
@danbarua
Copy link

danbarua commented May 9, 2023

This is a valid request, and the implementation needs to be looked at carefully to avoid thrashing the Garbage Collector in high-traffic applications.

If my memory serves me correctly I have looked into it in the past and hit an obstacle with cleanup.

@danbarua
Copy link

danbarua commented May 9, 2023

And we are in Modern DotNet where we now have Span<T> and other useful things in the base class libraries.

The original NEventSocket was intended to run on Mono as well as DotNet, we can make some big improvements now that dotnet is properly cross-platform.

entenschnabel and others added 2 commits November 13, 2024 14:23
…of a UTF-8 string. This byte array is then used for further parsing in the derived EventMessage class to save converting back again to a byte array from a UTF-8 string. Tests have been extended to include a DetectedSpeech event. There are two variants of this event which are used in the tests, one containing a response with English text in the body and another containing German text and umlaut characters. Add Logger initializer to MessageParsingTests class to allow its test cases to be run independently. Add new test case to MessageParsingTests to test for the successful extraction of body payload from the EventMessage.
@ajgolledge ajgolledge force-pushed the parse-multibyte-encoded-byte-arrays branch from 74cd2ff to 804a0b9 Compare November 13, 2024 15:02
@ajgolledge
Copy link
Author

Would somebody be able to take another look at this? We have been using it in production ourselves for a few years now.

@danbarua
Copy link

I'll take a look. I see that #26 is related.

Although it is an internal behavioural change, I think we should release with a Major Version bump.

I hope this will encourage users to test thoroughly before deploying to production.

@ajgolledge
Copy link
Author

Thanks for taking a look at this @danbarua, much appreciated. I don't think that #26 is related to this though. I did add a couple of extra unit tests in #26 so that it is hopefully a little clearer how to reproduce that particular problem but it isn't really related to this pull request.

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.

4 participants