boolean nextChar(iteratedChar it, CharsetDetector det) {
            it.error = false;
            int firstByte = 0;
            int secondByte = 0;
            int thirdByte = 0;
            //int fourthByte = 0;

            buildChar:
            {
                firstByte = it.charValue = it.nextByte(det);
                if (firstByte < 0) {
                    // Ran off the end of the input data
                    it.done = true;
                    break buildChar;
                }
                if (firstByte <= 0x8d) {
                    // single byte char
                    break buildChar;
                }

                secondByte = it.nextByte(det);
                it.charValue = (it.charValue << 8) | secondByte;

                if (firstByte >= 0xA1 && firstByte <= 0xfe) {
                    // Two byte Char
                    if (secondByte < 0xa1) {
                        it.error = true;
                    }
                    break buildChar;
                }
                if (firstByte == 0x8e) {
                    // Code Set 2.
                    //   In EUC-JP, total char size is 2 bytes, only one byte of actual char value.
                    //   In EUC-TW, total char size is 4 bytes, three bytes
                    //   contribute to char value.
                    // We don't know which we've got.
                    // Treat it like EUC-JP.  If the data really was EUC-TW, the following two
                    //   bytes will look like a well formed 2 byte char.
                    if (secondByte < 0xa1) {
                        it.error = true;
                    }
                    break buildChar;
                }

                if (firstByte == 0x8f) {
                    // Code set 3.
                    // Three byte total char size, two bytes of actual char value.
                    thirdByte = it.nextByte(det);
                    it.charValue = (it.charValue << 8) | thirdByte;
                    if (thirdByte < 0xa1) {
                        it.error = true;
                    }
                }
            }

            return (it.done == false);
        }
EUC charset recognizers.  One abstract class that provides the common function
for getting the next character according to the EUC encoding scheme,
and nested derived classes for EUC_KR, EUC_JP, EUC_CN.
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-text-module/src/main/java/org/apache/tika/parser/txt/CharsetRecog_mbcs.java