Class JSURLEncoder
java.lang.Object
com.oracle.truffle.js.runtime.builtins.JSURLEncoder
Utility class for
encodeURI and encodeURIComponent.
When encoding a String, the following rules apply:
- The alphanumeric characters "
a" through "z", "A" through "Z" and "0" through "9" remain the same. - The special characters in the
markset in the case ofencodeURIComponent, and additionally those in thereservedset plus "#invalid input: '"' in the case ofencodeURI; remain the same. - The space character "
" is converted into a plus sign "+". - All other characters are unsafe and are first converted into one or more bytes using some
encoding scheme. Then each byte is represented by the 3-character string "
%xy", where xy is the two-digit hexadecimal representation of the byte. The default encoding scheme is UTF-8.
-
Constructor Summary
ConstructorsConstructorDescriptionJSURLEncoder(boolean isSpecial) JSURLEncoder(boolean isSpecial, Charset charset) -
Method Summary
Modifier and TypeMethodDescriptionstatic charcharForDigit(int digit, int radix) LikeCharacter.forDigit(int, int), but returns uppercase letters.com.oracle.truffle.api.strings.TruffleStringencode(com.oracle.truffle.api.strings.TruffleString s)
-
Constructor Details
-
JSURLEncoder
public JSURLEncoder(boolean isSpecial) -
JSURLEncoder
-
-
Method Details
-
encode
public com.oracle.truffle.api.strings.TruffleString encode(com.oracle.truffle.api.strings.TruffleString s) -
charForDigit
public static char charForDigit(int digit, int radix) LikeCharacter.forDigit(int, int), but returns uppercase letters.
-