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

Support of ASCII strings #331

Open
devOneTwoThree opened this issue Oct 16, 2023 · 0 comments
Open

Support of ASCII strings #331

devOneTwoThree opened this issue Oct 16, 2023 · 0 comments

Comments

@devOneTwoThree
Copy link

devOneTwoThree commented Oct 16, 2023

We use MsgPack for unpacking data that has been packed by some external partner (I think they use a PHP implementation of MsgPack).

The strings in the packets are encoded in ASCII (codepage 1252). Unpacking works in most cases but not when strings contain german Umlaute.

I implemented my own 'Unpacker' which is basically just a wrapper of the default unpacker that only overrides the ReadString(out string result) Method. Works for me, but is not very convenient. I would appreciate an easier possibility to support different encodings. E.g. if Unpacker.Create(..) would have an option to specify the encoding or if there were an implementation of AsciiUnpacker delivered with MsgPack.

Here is my implementation of AsciiUnpacker and a usage example:

var serializer = MessagePackSerializer.Get<MyType[]>(_context); Unpacker unpacker = new AsciiUnpacker(stream); MyType[] data = serializer.UnpackFrom(unpacker);
AsciiUnpacker.txt

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

No branches or pull requests

1 participant