public class PercentCodec extends AbstractCharacterCodec
Encoder
Constructor and Description |
---|
PercentCodec() |
Modifier and Type | Method and Description |
---|---|
Character |
decodeCharacter(PushbackSequence<Character> input)
Returns the decoded version of the next character from the input string and advances the
current character in the
PushbackSequence . |
String |
encodeCharacter(char[] immune,
Character c)
Encode a character for URLs
|
decode
containsCharacter, encode, encodeCharacter, encodeCharacter, getHexForNonAlphanumeric, getHexForNonAlphanumeric, toHex, toHex, toOctal
public String encodeCharacter(char[] immune, Character c)
encodeCharacter
in interface Codec<Character>
encodeCharacter
in class AbstractCodec<Character>
immune
- Additional characters not to encode. Note this could
break URL encoding as referenced in RFC 3986. You should
especially be wary of including '%' in this list of immune
characters since it is used as the "escape" character for
the hex encoding and including it may result in subsequent
and/or dangerous results when decoding.c
- character to encodepublic Character decodeCharacter(PushbackSequence<Character> input)
PushbackSequence
. If the current character is not encoded, this
method MUST reset the PushbackString
.
Formats all are legal both upper/lower case:
%hh;decodeCharacter
in interface Codec<Character>
decodeCharacter
in class AbstractCodec<Character>
input
- encoded character using percent characters (such as URL encoding)Copyright © 2023 The Open Worldwide Application Security Project (OWASP). All rights reserved.