From 1b43233ba7de7915296d9b45a1a3048303edd4b6 Mon Sep 17 00:00:00 2001 From: Sean Owen Date: Thu, 5 Jun 2014 23:22:21 +0100 Subject: [PATCH] Issue #166 consume ECI in PDF417; still need to use it --- .../decoder/DecodedBitStreamParser.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/core/src/main/java/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java b/core/src/main/java/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java index 4d39b4204..a743eec5a 100644 --- a/core/src/main/java/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java +++ b/core/src/main/java/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java @@ -17,10 +17,12 @@ package com.google.zxing.pdf417.decoder; import com.google.zxing.FormatException; +import com.google.zxing.common.CharacterSetECI; import com.google.zxing.common.DecoderResult; import com.google.zxing.pdf417.PDF417ResultMetadata; import java.math.BigInteger; +import java.nio.charset.Charset; import java.util.Arrays; /** @@ -44,6 +46,9 @@ final class DecodedBitStreamParser { private static final int BYTE_COMPACTION_MODE_LATCH = 901; private static final int NUMERIC_COMPACTION_MODE_LATCH = 902; private static final int BYTE_COMPACTION_MODE_LATCH_6 = 924; + private static final int ECI_USER_DEFINED = 925; + private static final int ECI_GENERAL_PURPOSE = 926; + private static final int ECI_CHARSET = 927; private static final int BEGIN_MACRO_PDF417_CONTROL_BLOCK = 928; private static final int BEGIN_MACRO_PDF417_OPTIONAL_FIELD = 923; private static final int MACRO_PDF417_TERMINATOR = 922; @@ -107,6 +112,20 @@ final class DecodedBitStreamParser { case NUMERIC_COMPACTION_MODE_LATCH: codeIndex = numericCompaction(codewords, codeIndex, result); break; + case ECI_CHARSET: + CharacterSetECI charsetECI = + CharacterSetECI.getCharacterSetECIByValue(codewords[codeIndex++]); + Charset charset = Charset.forName(charsetECI.name()); + // TODO actually use charset! + break; + case ECI_GENERAL_PURPOSE: + // Can't do anything with generic ECI; skip its 2 characters + codeIndex += 2; + break; + case ECI_USER_DEFINED: + // Can't do anything with user ECI; skip its 1 character + codeIndex ++; + break; case BEGIN_MACRO_PDF417_CONTROL_BLOCK: codeIndex = decodeMacroBlock(codewords, codeIndex, resultMetadata); break;