Repository navigation
Update README.md - #279
Open
altivi wants to merge 1 commit into
Open
Update README.md#279altivi wants to merge 1 commit into
altivi wants to merge 1 commit into
Conversation
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi! I made the Ruby gem lz_string.
Pull request 274 struck it through in the README as "only partial support" and listed
lzstring-ruby as the complete version. That was right about
lz_string 0.3.0: emoji did not work in it. Two things have changed since then.
lz_string 1.0.0 passes your test suite
lz_string 1.0.0 passes
test/test.sh, 70 of 70 checks:It has every function of lz-string 2 (custom too) and a command line tool with the same options.
I also compared it with lz-string 2 on 20,000 random strings (all of Unicode: emoji, lone surrogates,
__proto__), 343 long ones (up to 200,000 characters) and 40,000 broken inputs, in all 6 encodings:410,066 checks, 0 differences. With 1.5.0 it is the same for all real data.
Its CI runs your
test.shon every push.lzstring-ruby 1.0.0 gives other results than lz-string, and loses data
compressToBase64("🎶")"jwbjb9o=""m3PQ"decompressFromBase64("jwbjb9o=")"🎶""??""👨👩👧👦""👨👩👧👦""????????""I ❤ 🎶 music"(in lzstring-ruby itself)"I ❤ music"compressToBase64("ö")"G9A=""m8AQ"compressToBase64("")"Q==="""The causes are in its source:
it reads Ruby characters
(code points), not UTF-16 code units, so an emoji loses its top bits;
it writes characters 128 to 255 with 16 bits
(
< 128where lz-string has< 256); andit turns surrogates into "?"
when it decompresses.
With
test.shand its ownlzstringcommand, it passes 13 of 70 checks, and 0 of the 35 compress checks(with
--no-verify: 23 of 70).Part of this comes from its command line tool, which reads and writes UTF-8, while your tool and the test data use
UTF-16 code units. The table above shows the problems in the compression itself.
./test.shoutput for lzstring-ruby 1.0.0✘: the data doesn't match. ‼: the command failed. Decompress only reads back the tool's own output.
To see it yourself:
This pull request
Thank you for lz-string and for the test suite. It made this easy to check.