fixed various bugs with encoding qrcodes

This commit is contained in:
Henry Schimke
2023-01-08 15:34:00 -06:00
parent caaf4c2fe0
commit 104e66c410
3 changed files with 18 additions and 3 deletions

View File

@@ -1052,7 +1052,14 @@ impl RXingResultNode {
.encode_string(
// &self.stringToEncode[self.fromPosition as usize
// ..(self.fromPosition + self.characterLength as usize)],
self.stringToEncode.get(self.fromPosition).unwrap(),
// self.stringToEncode.get(self.fromPosition).unwrap(),
&(self
.stringToEncode
.iter()
.skip(self.fromPosition)
.take(self.characterLength as usize)
.map(|s| s.as_str())
.collect::<String>()),
self.charsetEncoderIndex,
)
.len() as u32
@@ -1080,7 +1087,13 @@ impl RXingResultNode {
encoder::appendBytes(
// &self.stringToEncode[self.fromPosition as usize
// ..(self.fromPosition + self.characterLength as usize)],
self.stringToEncode.get(self.fromPosition).unwrap(),
&(self
.stringToEncode
.iter()
.skip(self.fromPosition)
.take(self.characterLength as usize)
.map(|s| s.as_str())
.collect::<String>()), //self.stringToEncode.get(self.fromPosition).unwrap(),
self.mode,
bits,
self.encoders.getCharset(self.charsetEncoderIndex),