mirror of
https://github.com/zxing/zxing.git
synced 2024-11-09 20:44:03 -08:00
Allow the + character in phone numbers. In the same time, fix a bug where other non allowed characters (such as /, or &) in url attributes would generate a non valid url.
git-svn-id: https://zxing.googlecode.com/svn/trunk@795 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
48480eba95
commit
280bb12e34
|
@ -181,7 +181,7 @@ public class Generator implements EntryPoint {
|
|||
result += "x";
|
||||
result += sizeY;
|
||||
result += "&chl=";
|
||||
result += URL.encode(content);
|
||||
result += URL.encodeComponent(content);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@ package com.google.zxing.web.generator.client;
|
|||
*/
|
||||
public final class Validators {
|
||||
public static String filterNumber(String number) {
|
||||
return number.replaceAll("[ +\\.,\\-\\(\\)]", "");
|
||||
return number.replaceAll("[ \\.,\\-\\(\\)]", "");
|
||||
}
|
||||
|
||||
public static void validateNumber(String number) throws GeneratorException {
|
||||
if (!number.matches("[0-9]+")) {
|
||||
if (!number.matches("\\+?[0-9]+")) {
|
||||
throw new GeneratorException("Phone number must be digits only.");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue