public final class RFC2231Utility extends Object
Constructor and Description |
---|
RFC2231Utility() |
Modifier and Type | Method and Description |
---|---|
static String |
decodeText(String encodedText)
Decode a string of text obtained from a HTTP header as per RFC 2231
Eg 1.
|
static boolean |
hasEncodedValue(String paramName)
Checks if Asterisk (*) at the end of parameter name to indicate,
if it has charset and language information to decode the value
|
static String |
stripDelimiter(String paramName)
If
paramName has Asterisk (*) at the end, it will be stripped off,
else the passed value will be returned |
public static boolean hasEncodedValue(String paramName)
paramName
- The parameter, which is being checked.true
, if encoded as per RFC 2231, false
otherwisepublic static String stripDelimiter(String paramName)
paramName
has Asterisk (*) at the end, it will be stripped off,
else the passed value will be returnedparamName
- The parameter, which is being inspected.paramName
of Asterisk (*), if RFC2231 encodedpublic static String decodeText(String encodedText) throws UnsupportedEncodingException
us-ascii'en-us'This%20is%20%2A%2A%2Afun%2A%2A%2A
will be decoded to This is ***fun***
Eg 2. iso-8859-1'en'%A3%20rate
will be decoded to £ rate
.
Eg 3. UTF-8''%c2%a3%20and%20%e2%82%ac%20rates
will be decoded to £ and € rates
.encodedText
- - Text to be decoded has a format of <charset>'<language>'<encoded_value>
and ASCII onlyUnsupportedEncodingException
- The requested character set wasn't found.Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.