Class JavascriptString


  • public class JavascriptString
    extends Object
    Utility class for JavaScript compatible UTF-8 encoding and decoding.
    See Also:
    Stackoverflow
    • Method Detail

      • decodeURIComponent

        public static String decodeURIComponent​(String s)
        Decodes the passed UTF-8 String using an algorithm that's compatible with JavaScript's decodeURIComponent function. Returns null if the String is null.
        Parameters:
        s - The UTF-8 encoded String to be decoded
        Returns:
        the decoded String
      • encodeURIComponent

        public static String encodeURIComponent​(String s)
        Encodes the passed String as UTF-8 using an algorithm that's compatible with JavaScript's encodeURIComponent function. Returns null if the String is null.
        Parameters:
        s - The String to be encoded
        Returns:
        the encoded String