From a2c11d45e63453d8235876a3d11685fb7febb07e Mon Sep 17 00:00:00 2001 From: Sean Owen Date: Sun, 5 Oct 2014 14:34:58 +0100 Subject: [PATCH] Fixes #235 : Don't remove + in MECARD TEL: field --- .../zxing/web/generator/client/ContactInfoGenerator.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/zxing.appspot.com/src/main/java/com/google/zxing/web/generator/client/ContactInfoGenerator.java b/zxing.appspot.com/src/main/java/com/google/zxing/web/generator/client/ContactInfoGenerator.java index 1e73d6e4a..eb52c1f58 100644 --- a/zxing.appspot.com/src/main/java/com/google/zxing/web/generator/client/ContactInfoGenerator.java +++ b/zxing.appspot.com/src/main/java/com/google/zxing/web/generator/client/ContactInfoGenerator.java @@ -92,7 +92,7 @@ public final class ContactInfoGenerator implements GeneratorSource { output.append("MECARD:"); maybeAppendMECARD(output, "N", name.replace(",", "")); maybeAppendMECARD(output, "ORG", company); - maybeAppendMECARD(output, "TEL", keepOnlyDigits(tel)); + maybeAppendMECARD(output, "TEL", tel == null ? null : tel.replaceAll("[^0-9+]+", "")); maybeAppendMECARD(output, "URL", url); maybeAppendMECARD(output, "EMAIL", email); maybeAppendMECARD(output, "ADR", buildAddress(address, address2)); @@ -110,11 +110,7 @@ public final class ContactInfoGenerator implements GeneratorSource { output.append(';'); return output.toString(); } - - private static String keepOnlyDigits(String s) { - return s == null ? null : s.replaceAll("[^0-9]+", ""); - } - + private static String buildAddress(String address, String address2) { if (!address.isEmpty()) { if (!address2.isEmpty()) {