78 builder.
Append(ref handler);
83 if (c >=
' ' && c !=
'"' && c !=
'\\' && c !=
'\'' && c !=
'<' && c !=
'>' && c !=
'&' && c !=
'\u0085' && c !=
'\u2028')
90 [
return: NotNullIfNotNull(
"value")]
93 if (
string.IsNullOrEmpty(
value))
127 output.
Write(
s.AsSpan(0, num));
129 for (
int i = 0; i < readOnlySpan.
Length; i++)
131 char c = readOnlySpan[i];
137 output.
Write(
"<");
140 output.
Write(
""");
143 output.
Write(
"'");
146 output.
Write(
"&");
160 [
return: NotNullIfNotNull(
"value")]
163 if (!
string.IsNullOrEmpty(
value))
179 [
return: NotNullIfNotNull(
"value")]
182 if (!
string.IsNullOrEmpty(
value))
201 for (
int i = 0; i < readOnlySpan.
Length; i++)
203 switch (readOnlySpan[i])
226 if (
string.IsNullOrEmpty(
value))
233 for (
int i = 0; i <
value.Length; i++)
238 if (stringBuilder ==
null)
251 stringBuilder.
Append(
"\\r");
254 stringBuilder.
Append(
"\\t");
257 stringBuilder.
Append(
"\\\"");
260 stringBuilder.
Append(
"\\\\");
263 stringBuilder.
Append(
"\\n");
266 stringBuilder.
Append(
"\\b");
269 stringBuilder.
Append(
"\\f");
281 if (stringBuilder ==
null)
292 [
return: NotNullIfNotNull(
"bytes")]
301 for (
int i = 0; i <
count; i++)
304 byte b =
bytes[num2];
315 if ((num3 | num4) != 255)
317 b = (byte)((num3 << 4) | num4);
325 if (num <
array.Length)
327 byte[] array2 =
new byte[num];
334 [
return: NotNullIfNotNull(
"bytes")]
342 for (
int i = 0; i <
count; i++)
362 if ((num2 | num3 | num4 | num5) != 255)
364 char ch = (char)((num2 << 12) | (num3 << 8) | (num4 << 4) | num5);
374 if ((num6 | num7) != 255)
376 b = (byte)((num6 << 4) | num7);
387 [
return: NotNullIfNotNull(
"value")]
396 for (
int i = 0; i <
length; i++)
415 if ((num | num2 | num3 | num4) != 255)
417 c = (char)((num << 12) | (num2 << 8) | (num3 << 4) | num4);
427 if ((num5 | num6) != 255)
429 byte b = (byte)((num5 << 4) | num6);
437 if ((c & 0xFF80) == 0)
449 [
return: NotNullIfNotNull(
"bytes")]
457 return (
byte[])
array.Clone();
460 [
return: NotNullIfNotNull(
"bytes")]
469 for (
int i = 0; i <
count; i++)
481 if (num == 0 && num2 == 0)
491 byte[] array2 =
new byte[
count + num2 * 2];
493 for (
int j = 0; j <
count; j++)
524 for (
int i = 0; i <
count; i++)
537 for (
int j = 0; j <
count; j++)
554 [Obsolete(
"This method produces non-standards-compliant output and has interoperability issues. The preferred alternative is UrlEncode(*).")]
555 [
return: NotNullIfNotNull(
"value")]
564 for (
int i = 0; i <
length; i++)
567 if ((c & 0xFF80) == 0)
576 stringBuilder.
Append(
'+');
579 stringBuilder.
Append(
'%');
585 stringBuilder.
Append(
"%u");
595 [
return: NotNullIfNotNull(
"value")]
598 if (
string.IsNullOrEmpty(
value))
604 schemeAndAuthority =
null;
606 queryAndFragment =
null;
613 if (
string.IsNullOrEmpty(
value))
617 int num =
value.IndexOf(
'?');
635 if (offset < 0 || offset >
bytes.Length)
639 if (count < 0 || offset + count >
bytes.Length)
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
static void BlockCopy(Array src, int srcOffset, Array dst, int dstOffset, int count)
static CultureInfo InvariantCulture
static char ToCharLower(int value)
static int FromChar(int c)
override string ToString()
virtual void Write(char value)
static ? string HtmlDecode(string? value)
static ? string HtmlEncode(string? value)
virtual byte[] GetBytes(char[] chars)
virtual char[] GetChars(byte[] bytes)
override string ToString()
StringBuilder Append(char value, int repeatCount)
static bool IsUrlSafeChar(char ch)
static string UrlEncodeSpaces(string str)
readonly Encoding _encoding
UrlDecoder(int bufferSize, Encoding encoding)
readonly char[] _charBuffer
static string UrlEncodeNonAscii(string str, Encoding e)
static byte[] UrlEncode(byte[] bytes, int offset, int count, bool alwaysCreateNewReturnValue)
static string UrlDecode(string value, Encoding encoding)
static bool IsNonAsciiByte(byte b)
static void HtmlEncode(string value, TextWriter output)
static string HtmlDecode(string value)
static string UrlEncodeUnicode(string value)
static bool CharRequiresJavaScriptEncoding(char c)
static bool ValidateUrlEncodingParameters([NotNullWhen(true)] byte[] bytes, int offset, int count)
static byte[] UrlEncode(byte[] bytes, int offset, int count)
static string JavaScriptStringEncode(string value)
static void HtmlAttributeEncodeInternal(string s, TextWriter output)
static void HtmlAttributeEncode(string value, TextWriter output)
static string HtmlEncode(string value)
static string UrlPathEncodeImpl(string value)
static byte[] UrlEncodeNonAscii(byte[] bytes, int offset, int count)
static string UrlDecode(byte[] bytes, int offset, int count, Encoding encoding)
static void AppendCharAsUnicodeJavaScript(StringBuilder builder, char c)
static void HtmlDecode(string value, TextWriter output)
static string UrlPathEncode(string value)
static string HtmlAttributeEncode(string value)
static int IndexOfHtmlAttributeEncodingChars(string s, int startPos)
static byte[] UrlDecode(byte[] bytes, int offset, int count)
static bool TrySplitUriForPathEncode(string input, [NotNullWhen(true)] out string schemeAndAuthority, [NotNullWhen(true)] out string path, out string queryAndFragment)
static string ValidateString(string input)
void AppendLiteral(string value)
void AppendFormatted(ReadOnlySpan< char > value)