public static String encodeInUtf8(String url) {
        String[] parts = url.split("/");
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < parts.length; i++) {
            String part = parts[i];
            builder.append(URLEncoder.encode(part, StandardCharsets.UTF_8));
            if (i < parts.length - 1) {
                builder.append('/');
            }
        }
        if (url.endsWith("/")) {
            builder.append('/');
        }
        return builder.toString();
    }
@Test
    public void shouldEncodeAllPartsInUrl() {
        assertThat(UrlUtil.encodeInUtf8("a%b/c%d"), is("a%25b/c%25d"));
    }