mirror of
https://github.com/zxing/zxing.git
synced 2025-02-21 02:55:27 -08:00
URL-decode email address in mailto: link
git-svn-id: https://zxing.googlecode.com/svn/trunk@2573 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
62bd9719a8
commit
3b9b63da18
|
@ -39,6 +39,7 @@ public final class EmailAddressResultParser extends ResultParser {
|
||||||
if (queryStart >= 0) {
|
if (queryStart >= 0) {
|
||||||
emailAddress = emailAddress.substring(0, queryStart);
|
emailAddress = emailAddress.substring(0, queryStart);
|
||||||
}
|
}
|
||||||
|
emailAddress = urlDecode(emailAddress);
|
||||||
Map<String,String> nameValues = parseNameValuePairs(rawText);
|
Map<String,String> nameValues = parseNameValuePairs(rawText);
|
||||||
String subject = null;
|
String subject = null;
|
||||||
String body = null;
|
String body = null;
|
||||||
|
|
|
@ -184,16 +184,22 @@ public abstract class ResultParser {
|
||||||
String key = keyValueTokens[0];
|
String key = keyValueTokens[0];
|
||||||
String value = keyValueTokens[1];
|
String value = keyValueTokens[1];
|
||||||
try {
|
try {
|
||||||
value = URLDecoder.decode(value, "UTF-8");
|
value = urlDecode(value);
|
||||||
result.put(key, value);
|
result.put(key, value);
|
||||||
} catch (UnsupportedEncodingException uee) {
|
|
||||||
throw new IllegalStateException(uee); // can't happen
|
|
||||||
} catch (IllegalArgumentException iae) {
|
} catch (IllegalArgumentException iae) {
|
||||||
// continue; invalid data such as an escape like %0t
|
// continue; invalid data such as an escape like %0t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static String urlDecode(String encoded) {
|
||||||
|
try {
|
||||||
|
return URLDecoder.decode(encoded, "UTF-8");
|
||||||
|
} catch (UnsupportedEncodingException uee) {
|
||||||
|
throw new IllegalStateException(uee); // can't happen
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static String[] matchPrefixedField(String prefix, String rawText, char endChar, boolean trim) {
|
static String[] matchPrefixedField(String prefix, String rawText, char endChar, boolean trim) {
|
||||||
List<String> matches = null;
|
List<String> matches = null;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
Loading…
Reference in a new issue