I was trying to use MessagePack to serialize integers from 0 to 127 in C++ and in C# on Windows, but the results are not the same. msgpack-c inserts 0x0D between 0x09 and 0x0A, but MessagePack-CSharp does not. Why is that?
OS: Windows 10
IDE: Visual Studio 2019
C#
library:
https://github.com/neuecc/MessagePack-CSharp
code:
using System.Collections.Generic;
using System.IO;
class Program
{
static void Main(string[] args)
{
using (FileStream fileStream = new FileStream("CSharp.msgpack", FileMode.Create, FileAccess.Write))
{
List<int> list = new List<int>();
for (int i = 0; i < 128; ++i)
{
list.Add(i);
}
MessagePackSerializer.Serialize(fileStream, list);
}
}
}
result:
C++
library:
https://github.com/msgpack/msgpack-c
code:
#include <msgpack.hpp>
#include <vector>
#include <iostream>
#include <fstream>
int main(void)
{
std::ofstream OutputFileStream;
std::vector<int> list;
for (int i = 0; i < 128; ++i)
{
list.push_back(i);
}
OutputFileStream.open("Cpp.msgpack");
msgpack::pack(OutputFileStream, list);
OutputFileStream.close();
}
result: