starwing / lua-protobuf

A Lua module to work with Google protobuf
MIT License
1.75k stars 387 forks source link

使用 pb.encode 后,将字符串存入 C# 侧,发现字节数不正确。有什么好建议去解决这个问题吗? #193

Closed dreamCirno closed 2 years ago

dreamCirno commented 2 years ago

类似的问题:protobuf-lua序列化的数据传入C#丢失解决办法

dreamCirno commented 2 years ago

使用环境是 xLua。 配套使用 Encoding.Unicode.GetString、Encoding.Unicode.GetBytes 方法。目前看起来能够解决我的问题。 想了解是否有更好的解决方式。

dreamCirno commented 2 years ago

更新:改用 Convert.ToBase64String、Convert.FromBase64String 方式可以解决。