zxing/zxing · warning · GeneratorException

Tel must not contains ; characters

Error message

Tel must not contains ; characters

What it means

Thrown by ContactInfoGenerator.getTelField when the telephone string, after filtering, still contains a semicolon. Semicolons delimit vCard/MeCard components and would break the QR payload structure, so they are explicitly forbidden even though Validators.filterNumber already strips spaces, dots, commas, hyphens and parentheses. Client-side (GWT) input validation in the ZXing web generator.

Source

Thrown at zxing.appspot.com/src/main/java/com/google/zxing/web/generator/client/ContactInfoGenerator.java:190

    return input;
  }
  
  private String getCompanyField() {
    return company.getText();
  }

  private String getTitleField() {
    return title.getText();
  }

  private String getTelField() throws GeneratorException {
    String input = Validators.filterNumber(tel.getText());
    if (input.isEmpty()) {
      return "";
    }
    Validators.validateNumber(input);
    if (input.contains(";")) {
      throw new GeneratorException("Tel must not contains ; characters");
    }
    return input;
  }
  
  private String getUrlField() throws GeneratorException {
    String input = url.getText();
    if (input != null && !input.isEmpty()) {
      Validators.validateUrl(input);
    }
    return input;
  }
  
  private String getEmailField() throws GeneratorException {
    String input = email.getText();
    if (input.isEmpty()) {
      return "";
    }
    Validators.validateEmail(input);

View on GitHub (pinned to 19aa2d8254)

Solutions

  1. Remove all ';' characters from the telephone field before generating.
  2. Use a different separator for extensions (the generator will not encode ';' safely) or omit extensions.
  3. Sanitize input in a change handler to strip ';\n'.
  4. Note filterNumber only removes [ .,\-()] — add ';' to the sanitization step.

Example fix

// before
String input = "555;123"; // contains ';' -> throws

// after
String input = "555123"; // or "555-123" which filterNumber strips to 555123
Defensive patterns

Strategy: validation

Validate before calling

String input = Validators.filterNumber(tel.getText());
if (input.indexOf(';') >= 0) {
  // strip or reject the semicolon before generation
  input = input.replace(";", "");
}

Type guard

boolean hasNoSemicolon(String s) {
  return s == null || s.indexOf(';') < 0;
}

Try / catch

try {
  generator.getText();
} catch (GeneratorException e) {
  // tel contained ';'; tell user to remove it
}

Prevention

When it happens

Trigger: The user enters a phone number containing a ';' (e.g. a number with an extension separator like '555;123') that survives filterNumber, and triggers generation.

Common situations: Phone numbers pasted from PBX/extension formats using ';' as a separator; SIP URI fragments; malicious or accidental semicolon entry.

Related errors


AI-assisted analysis of zxing/zxing@19aa2d8254 (2026-08-14). Data as JSON: /api/errors/7096f33cd420163f. Report an issue: GitHub.