Class MinimalEncoder


  • final class MinimalEncoder
    extends java.lang.Object
    Encoder that encodes minimally Algorithm: The eleventh commandment was "Thou Shalt Compute" or "Thou Shalt Not Compute" - I forget which (Alan Perilis). This implementation computes. As an alternative, the QR-Code specification suggests heuristics like this one: If initial input data is in the exclusive subset of the Alphanumeric character set AND if there are less than [6,7,8] characters followed by data from the remainder of the 8-bit byte character set, THEN select the 8- bit byte mode ELSE select Alphanumeric mode; This is probably right for 99.99% of cases but there is at least this one counter example: The string "AAAAAAa" encodes 2 bits smaller as ALPHANUMERIC(AAAAAA), BYTE(a) than by encoding it as BYTE(AAAAAAa). Perhaps that is the only counter example but without having proof, it remains unclear. ECI switching: In multi language content the algorithm selects the most compact representation using ECI modes. For example the most compact representation of the string "ŐŜ" (O-double-acute, S-circumflex) is ECI(UTF-8), BYTE(ŐŜ) while prepending one or more times the same leading character as in "ŐŐŜ", the most compact representation uses two ECIs so that the string is encoded as ECI(ISO-8859-2), BYTE(ŐŐ), ECI(ISO-8859-3), BYTE(Ŝ).