Closed nanikamado closed 2 years ago
Thanks for your issue. I think it's an issue how zbar tries to interpret the data. I added a test case for it. The trick is to decode the data from UTF-8 and to encode the data Shift-JIS. Then the you'll get the expected result.
It's written a bit different to avoid the Pillow dependency, though. https://github.com/heuer/segno/commit/11062bf76ebe999aafedb47f88431e71631bb82b
You are right, this seems to be a problem with zbar. I tried rqrr, a QR reader written in Rust, and it decoded the test.png to the original data correctly.
code:
use image;
use rqrr;
fn main() {
let img = image::open("test.png").unwrap().to_luma8();
let mut img = rqrr::PreparedImage::prepare(img);
let grids = img.detect_grids();
let mut content = Vec::new();
grids[0].decode_to(&mut content).unwrap();
println!("{:x?}", content); // --> [b8, d6, 90, af]
}
Thank you.
Encoding bytes into a QR code and decoding it produces data that is different from the original one.
code: