I've been adapting your LZJB source code to the Joose3 object system for
JavaScript.
See:
http://github.com/michaelsbradleyjr/Compress/blob/master/lib/Compress/LZJB.js
When running tests, I found that UTF-8 input wasn't being handled properly.
That is, when UTF-8 strings were input to the compress() method, then when that
output was input to decompress(), the original uncompressed strings and the
decompressed output did *not* match.
I tried reducing the complexity of the method you supplied as
Iuppiter.toByteArray:
toByteArray : function (input) {
var b = [], i, unicode
for(i = 0; i < input.length; i++) {
unicode = input.charCodeAt(i)
b.push(unicode)
}
return b
},
This seems to work. Both ASCII and UTF-8 input strings are compressed as
expected, and the output of decompress() matches exactly with the uncompressed
input to compress().
Can you explain why your Iuppiter.toByteArray method is constructed the way it
is in your source code? Am I missing something, and it's important to handle
charCodeAt() values differently for UTF-8 characters than the way you handle
those values for ASCII characters?
Thank you for your feedback.
Original issue reported on code.google.com by michaels...@gmail.com on 12 Sep 2010 at 1:44
Original issue reported on code.google.com by
michaels...@gmail.com
on 12 Sep 2010 at 1:44