protected static function urlencode_rfc3986($value)
{
if (is_array($value)) {
return array_map(array(__CLASS__, 'urlencode_rfc3986'), $value);
} else {
$search = array('+', ' ', '%7E', '%');
$replace = array('%20', '%20', '~', '%25');
return str_replace($search, $replace, urlencode($value));
}
}