decodeOrNull

fun decodeOrNull(s: String?, convertPlus: Boolean = false, throwOnFailure: Boolean = false): String?

Decodes '%'-escaped octets in the given string using the UTF-8 scheme. Replaces invalid octets with the unicode replacement character ("\\uFFFD").

Return

the given string with escaped octets decoded, or null if s is null

Parameters

s

encoded string to decode

convertPlus

if convertPlus == true all ‘+’ chars in the decoded output are converted to ‘ ‘ (white space)

throwOnFailure

if throwOnFailure == true an IllegalArgumentException is thrown for invalid inputs. Else, U+FFd is emitted to the output in place of invalid input octets.