Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7095d75e authored by Shimeng (Simon) Wang's avatar Shimeng (Simon) Wang Committed by Android Git Automerger
Browse files

am 447beb52: am 05fd7e7d: Add good international characters to the path part of Url pattern.

Merge commit '447beb52' into kraken

* commit '447beb52':
  Add good international characters to the path part of Url pattern.
parents 067521f9 447beb52
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -124,7 +124,7 @@ public class Patterns {
        + "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}"
        + "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}"
        + "|[1-9][0-9]|[0-9])))"
        + "|[1-9][0-9]|[0-9])))"
        + "(?:\\:\\d{1,5})?)" // plus option port number
        + "(?:\\:\\d{1,5})?)" // plus option port number
        + "(\\/(?:(?:[a-zA-Z0-9\\;\\/\\?\\:\\@\\&\\=\\#\\~"  // plus option query params
        + "(\\/(?:(?:[" + GOOD_IRI_CHAR + "\\;\\/\\?\\:\\@\\&\\=\\#\\~"  // plus option query params
        + "\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_])|(?:\\%[a-fA-F0-9]{2}))*)?"
        + "\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_])|(?:\\%[a-fA-F0-9]{2}))*)?"
        + "(?:\\b|$)"); // and finally, a word boundary or end of
        + "(?:\\b|$)"); // and finally, a word boundary or end of
                        // input.  This is to stop foo.sure from
                        // input.  This is to stop foo.sure from
+4 −0
Original line number Original line Diff line number Diff line
@@ -74,6 +74,10 @@ public class PatternsTest extends TestCase {
        t = Patterns.WEB_URL.matcher("\uD604\uAE08\uC601\uC218\uC99D.kr").matches();
        t = Patterns.WEB_URL.matcher("\uD604\uAE08\uC601\uC218\uC99D.kr").matches();
        assertTrue("Valid URL", t);
        assertTrue("Valid URL", t);


        t = Patterns.WEB_URL.matcher("http://brainstormtech.blogs.fortune.cnn.com/2010/03/11/" +
            "top-five-moments-from-eric-schmidt\u2019s-talk-in-abu-dhabi/").matches();
        assertTrue("Valid URL", t);

        t = Patterns.WEB_URL.matcher("ftp://www.example.com").matches();
        t = Patterns.WEB_URL.matcher("ftp://www.example.com").matches();
        assertFalse("Matched invalid protocol", t);
        assertFalse("Matched invalid protocol", t);