public static Optional<String> urlEncode(String raw) {
    try {
      return Optional.of(URLEncoder.encode(raw, UTF_8.toString()));
    } catch (UnsupportedEncodingException e) {
      return Optional.empty();
    }
  }
@Test
  public void urlEncode_whenComplexEncoding_encodesCorrectly() {
    assertThat(urlEncode("£")).hasValue("%C2%A3");
    assertThat(urlEncode("つ")).hasValue("%E3%81%A4");
    assertThat(urlEncode("äëïöüÿ")).hasValue("%C3%A4%C3%AB%C3%AF%C3%B6%C3%BC%C3%BF");
    assertThat(urlEncode("ÄËÏÖÜŸ")).hasValue("%C3%84%C3%8B%C3%8F%C3%96%C3%9C%C5%B8");
  }