-
Notifications
You must be signed in to change notification settings - Fork 3
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
Error: Memory allocated was shorter than necessary for multi-byte UTF-8 chars #2
Comments
Hello, are you able to share a string that fails in this manner? |
I was trying to compress this article (Chinese)
OS: macOS 10.13, 8G Memory |
Thank you for the example, this falls under the problem discussed in Ed-von-Schleck/shoco#11 In this case, the Chinese characters are 3 byte UTF-8 chars, which each become 6 bytes when encoded, so double their original size. The proposal discussed in Ed-von-Schleck/shoco#11 to use the 0x02, 0x03 and 0x04 prefixes for the char length would definitely help so if you're able to submit a PR upstream with that change that would be great. For now I'll add a comment to the README about the lack of usefulness for strings consisting heavily of multi-byte UTF-8 chars. (This module is designed for short text strings so if you're regularly compressing >1MB then perhaps consider an alternative such as gzip.) |
Thanks a lot. |
v0.3.0 now available with a fix for the problem you experienced, thanks for reporting. |
I was trying to compress a very long string, but failed. It prints
Error: Memory allocated was shorter than necessary
. How can I fix it?The text was updated successfully, but these errors were encountered: