diff --git a/src/main/java/io/mola/galimatias/URLParser.java b/src/main/java/io/mola/galimatias/URLParser.java index 6ef8ad3..263dcf5 100644 --- a/src/main/java/io/mola/galimatias/URLParser.java +++ b/src/main/java/io/mola/galimatias/URLParser.java @@ -517,8 +517,9 @@ else if (c == '#') { } atFlag = true; - for (int i = 0; i < buffer.length(); i++) { - final char otherChar = buffer.charAt(i); + + for (int i = 0; i < buffer.codePointCount(0, buffer.length()); i++) { + final int otherChar = buffer.codePointAt(i); if ( otherChar == 0x0009 || otherChar == 0x000A || diff --git a/src/test/resources/data/urltestdata_whatwg.txt b/src/test/resources/data/urltestdata_whatwg.txt index c9e7de7..bb135c8 100644 --- a/src/test/resources/data/urltestdata_whatwg.txt +++ b/src/test/resources/data/urltestdata_whatwg.txt @@ -324,3 +324,8 @@ feed:https://example.com/rss.xml s:feed p:https://example.com/rss.xml ed2k://|file|The_Two_Towers-The_Purist_Edit-Trailer.avi|14997504|965c013e991ee246d63d45ea71954c4d|/|sources,202.89.123.6:4662|/ s:ed2k p://|file|The_Two_Towers-The_Purist_Edit-Trailer.avi|14997504|965c013e991ee246d63d45ea71954c4d|/|sources,202.89.123.6:4662|/ magnet:?xt=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C s:magnet p: q:?xt=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C mailto:user@example.com s:mailto p:user@example.com + +-- +-- Misc Unicode +-- +http://foo:\uD83D\uDCA9@example.com/bar s:http h:example.com p:/bar u:foo pass:%F0%9F%92%A9