Issue 1102 fix escaping in wifi codes

git-svn-id: https://zxing.googlecode.com/svn/trunk@2084 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2011-12-13 15:18:18 +00:00
parent a569f179ff
commit 873608de67
3 changed files with 3 additions and 7 deletions

View file

@ -106,7 +106,7 @@ public final class ContactInfoGenerator implements GeneratorSource {
private static void maybeAppendMECARD(StringBuilder output, String prefix, String value) { private static void maybeAppendMECARD(StringBuilder output, String prefix, String value) {
if (value.length() > 0) { if (value.length() > 0) {
value = value.replaceAll("([:;])", "\\\\$1"); value = value.replaceAll("([\\\\:;])", "\\\\$1");
value = value.replaceAll("\\n", ""); value = value.replaceAll("\\n", "");
output.append(prefix).append(':').append(value).append(';'); output.append(prefix).append(':').append(value).append(';');
} }

View file

@ -86,11 +86,7 @@ public final class WifiGenerator implements GeneratorSource {
if (input.contains("\n")) { if (input.contains("\n")) {
throw new GeneratorException(name + " field must not contain \\n characters."); throw new GeneratorException(name + " field must not contain \\n characters.");
} }
input = input.replace(";", "\\;"); return input.replaceAll("([\\\\:;])", "\\\\$1");
input = input.replace(":", "\\:");
input = input.replace("\\", "\\\\");
input = input.replace("/", "\\/");
return input;
} }
private String getSsidField() throws GeneratorException { private String getSsidField() throws GeneratorException {

View file

@ -1,5 +1,5 @@
application: zxing application: zxing
version: 4 version: 5
runtime: python runtime: python
api_version: 1 api_version: 1