[Bug] Data changes when encode and then decode with dictionary
tohkayuri opened this issue · 3 comments
tohkayuri commented
- I trained a dict using https://github.com/google/brotli/blob/master/research/dictionary_generator.cc
- encode a byte array using this dict
- and then decode it
- I got different bytes compare to the original
So what's the problem?
I guess it may be brotli's bug, so I wonder if the new release version can solve this problem.
hyperxpro commented
Hey, Sorry I couldn't follow up since I was on vacation. Since you closed the issue, would you mind explaining how you fixed it?
tohkayuri commented
I mistakenly used the decompressed sdk. I should pass the raw dict data not PreparedDictionary.getData() to brotliOutputStream.attachDictionary. I have no idea why the compress and decompress have such a different interface.
hyperxpro commented
I agree about the problems with the Brotli API design. It's coming directly from the official repo. For 1.x releases, I choose to use the majority of official APIs but for 2.x release, I will re-write user-friendly APIs from scratch.