Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: the return value of utf8_to_gbk1 seems incorrect #216

Open
dzpao opened this issue Mar 11, 2024 · 3 comments
Open

BUG: the return value of utf8_to_gbk1 seems incorrect #216

dzpao opened this issue Mar 11, 2024 · 3 comments

Comments

@dzpao
Copy link
Contributor

dzpao commented Mar 11, 2024

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
Copy link
Contributor Author

dzpao commented Mar 11, 2024

image

@scandum
Copy link
Owner

scandum commented Mar 12, 2024

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?

@dzpao
Copy link
Contributor Author

dzpao commented Mar 12, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants