alibaba / hessian2-codec

hessian2-codec it is a complete C++ implementation of hessian2 spec
Apache License 2.0
26 stars 9 forks source link

string encoding/decoding is imcompatible with dubbo-hessian-lite for four char > 0xFFFF #23

Closed wbpcode closed 11 months ago

wbpcode commented 1 year ago

According to the Hessian2 standard, the string should be UTF8 encoded. However, UTF16 string is used by the Java. And when the dubbo-hessian-lite encoding the string, every UTF16 char is treated as one UTF8 char which is wrong.

Considering that most of dubbo users using dubbo-hessian-lite, we should try to provide the similar support for compatibility, even it's wrong.

wbpcode commented 11 months ago

This needn't be part of the core lib. We can extend the new type support by the toHessian2/fromHessian2.

wbpcode commented 11 months ago

I will keep this open because others may encounter similar problem.

wbpcode commented 11 months ago

Seems only 4bytes utf-8 cannot be handled correctly, may be we can still fix it. 🤔