Class UrlPathEncoder

java.lang.Object
fr.becpg.repo.helper.UrlPathEncoder

public final class UrlPathEncoder extends Object
Encodes a value, typically a file name, as a URL path segment or an RFC 5987 header parameter. Unlike org.springframework.extensions.surf.util.URLEncoder, which encodes each UTF-16 char on its own and therefore breaks characters outside the BMP (emojis) into two invalid sequences, this encoder works on code points and always produces valid UTF-8 percent-encoding.
Author:
valentin
  • Field Details

  • Constructor Details

    • UrlPathEncoder

      private UrlPathEncoder()
  • Method Details

    • encode

      public static String encode(String value)
      Percent-encodes a value in UTF-8, spaces included as %20.
      Parameters:
      value - the value to encode
      Returns:
      the encoded value