diff options
author | Shimeng (Simon) Wang <swang@google.com> | 2010-02-11 14:07:44 -0800 |
---|---|---|
committer | Shimeng (Simon) Wang <swang@google.com> | 2010-02-11 14:07:44 -0800 |
commit | 51c02dbf75fede9b2829af5b821f10e0bc2af124 (patch) | |
tree | 525a810a2aa54480225d933e9c4f6e8499e97952 /core/java | |
parent | b4489000d1355d10426bb4ad4eedb5c2fb80e886 (diff) | |
download | frameworks_base-51c02dbf75fede9b2829af5b821f10e0bc2af124.zip frameworks_base-51c02dbf75fede9b2829af5b821f10e0bc2af124.tar.gz frameworks_base-51c02dbf75fede9b2829af5b821f10e0bc2af124.tar.bz2 |
Enhance URL regular expression to match more Unicode chars.
Enhance URL regular expression to match legal one byte Unicode characters in
Internationalized Resource Identifiers as detailed in RFC 3987. Specifically
two byte Unicode characters are not included. Not all things in RFC 3987 is
implemented, this is just an enhancement for recognizing more common used one
byte Unicode characters.
This change helps Browser address bar identify more valid URL without scheme
typed in, such as 현금영수증.kr
make-iana-tld-pattern.py is modified to contain only Top Level Domain
regular expression generation. Other parts of WEB_URL pattern are in
solely in Patters.java for better consistency and maintenance.
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/net/WebAddress.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/java/android/net/WebAddress.java b/core/java/android/net/WebAddress.java index f4ae66a..2d078c1 100644 --- a/core/java/android/net/WebAddress.java +++ b/core/java/android/net/WebAddress.java @@ -16,6 +16,8 @@ package android.net; +import static com.android.common.Patterns.GOOD_IRI_CHAR; + import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -54,7 +56,7 @@ public class WebAddress { static Pattern sAddressPattern = Pattern.compile( /* scheme */ "(?:(http|HTTP|https|HTTPS|file|FILE)\\:\\/\\/)?" + /* authority */ "(?:([-A-Za-z0-9$_.+!*'(),;?&=]+(?:\\:[-A-Za-z0-9$_.+!*'(),;?&=]+)?)@)?" + - /* host */ "([-A-Za-z0-9%_]+(?:\\.[-A-Za-z0-9%_]+)*|\\[[0-9a-fA-F:\\.]+\\])?" + + /* host */ "([-" + GOOD_IRI_CHAR + "%_]+(?:\\.[-" + GOOD_IRI_CHAR + "%_]+)*|\\[[0-9a-fA-F:\\.]+\\])?" + /* port */ "(?:\\:([0-9]+))?" + /* path */ "(\\/?.*)?"); |