bgnet0
bgnet0 copied to clipboard
Bugfix wordserver: Prefix with length in bytes, not length in Unicode characters
As described in section 13.2 of the Word Server project, each packet should contain a UTF-8 encoded word "prefixed by the length of the word in bytes". However, the current implementation actually uses the length in characters, which differs if a word contains multi-byte characters.
Fixing this by using the length in bytes of the encoded word (len(word_bytes)
) instead of the length in characters of the un-encoded word (len(word)
).