Compress/decompress String On .net Server That Was Encoded With Lz-string.js On Client
Solution 1:
The full description in the link you give says that you should be able to use 'compressToUTF16' and it will always work, rather than just 'compress', which won't always work.
I've tested it personally and seen that it works.
(Though I changed the Context_Compress_Data.str field from a string to a StringBuilder in the C# file, because it was too slow to run. After that it took only 8 seconds for an 8 MB JSON file and compressed to 7% of the original size.)
Solution 2:
We fixed this by adding enc1 = enc2 = enc3 = enc4 = 0;
between the two rows below (line 580 in original file before stringbuilder version)
From what I remember, the bug was caused by the values of enc1, enc2, etc... not being reset at the start of each loop, so sometimes a new iteration of the loop had wrong values from the previous round.
i += 3;
enc1 = enc2 = enc3 = enc4 = 0;
enc1 = (int)(Math.Round(chr1)) >> 2;
Post a Comment for "Compress/decompress String On .net Server That Was Encoded With Lz-string.js On Client"