tintin icon indicating copy to clipboard operation
tintin copied to clipboard

BUG: the return value of utf8_to_gbk1 seems incorrect

Open dzpao opened this issue 1 year ago • 3 comments

Generally, a Chinese character should be 3 bytes using utf8 encoding, and 2 bytes using gbk, so usually utf8_to_gbk1 should return a smaller number (compared to the input parameters), but I observed by printing the debug log, The return value of utf8_to_gbk1 is always larger than expected.

In fact, I also discovered through packet capture that when I connect to the gbk server and send commands containing Chinese characters, there is always a string of zeros after the bytes actually sent on the socket.

Please help me check if something is wrong with utf8_to_gbk1. Thank you.

dzpao avatar Mar 11 '24 19:03 dzpao

image

dzpao avatar Mar 11 '24 19:03 dzpao

Thanks, looks like it wasn't keeping proper track of the input length.

I've updated the beta with a fix, would you mind checking if the problem is fixed?

scandum avatar Mar 12 '24 13:03 scandum

I just tested it and it's fine now. Thank you!

dzpao avatar Mar 12 '24 15:03 dzpao