ECC code mismatch detection by Shane32 · Pull Request #526 · Shane32/QRCoder (original) (raw)

This pull request enhances the QRCoder library by allowing the payload to specify an "unspecified" error correction level (ECC) rather than being restricted to the predefined levels L, M, Q, or H. This new Default value in the ECCLevel enum acts as an unspecified placeholder, giving users the flexibility to select an appropriate ECC level while enabling the system to validate the selection.

When generating a QR code, if the ECC level is not specified, the system uses the payload's specified ECC level. If the payload's ECC level differs from the user-specified level, the system throws an exception to handle the discrepancy. This enhancement ensures backward compatibility, allowing existing codebases to function as expected while offering users the flexibility to dynamically adjust error correction levels based on their payloads' needs.

See:

This PR also includes bug fix #527 ; please merge it first.