mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
Merge pull request #412 from strguntbr/multibyteFix
Fixed substring call
This commit is contained in:
commit
3b8ab085d8
|
@ -215,7 +215,7 @@ final class PDF417HighLevelEncoder {
|
||||||
if (b == 0) {
|
if (b == 0) {
|
||||||
b = 1;
|
b = 1;
|
||||||
}
|
}
|
||||||
byte[] bytes = msg.substring(p, b).getBytes(encoding);
|
byte[] bytes = msg.substring(p, p + b).getBytes(encoding);
|
||||||
if (bytes.length == 1 && encodingMode == TEXT_COMPACTION) {
|
if (bytes.length == 1 && encodingMode == TEXT_COMPACTION) {
|
||||||
//Switch for one byte (instead of latch)
|
//Switch for one byte (instead of latch)
|
||||||
encodeBinary(bytes, 0, 1, TEXT_COMPACTION, sb);
|
encodeBinary(bytes, 0, 1, TEXT_COMPACTION, sb);
|
||||||
|
|
|
@ -36,6 +36,12 @@ public final class PDF417EncoderTestCase extends Assert {
|
||||||
PDF417HighLevelEncoder.encodeHighLevel(
|
PDF417HighLevelEncoder.encodeHighLevel(
|
||||||
"1%§s ?aG$", Compaction.AUTO, StandardCharsets.UTF_8);
|
"1%§s ?aG$", Compaction.AUTO, StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEncodeIso88591WithSpecialChars() throws Exception {
|
||||||
|
// Just check if this does not throw an exception
|
||||||
|
PDF417HighLevelEncoder.encodeHighLevel("asdfg§asd", Compaction.AUTO, StandardCharsets.ISO_8859_1);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEncodeText() throws Exception {
|
public void testEncodeText() throws Exception {
|
||||||
|
|
Loading…
Reference in a new issue