Skip to content

Support of ASCII strings #331

@devOneTwoThree

Description

@devOneTwoThree

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions