Skip to content

Commit bc43bee

Browse files
fix rebase
1 parent 8dada18 commit bc43bee

File tree

1 file changed

+0
-52
lines changed
  • src/libraries/System.Web.HttpUtility/src/System/Web/Util

1 file changed

+0
-52
lines changed

src/libraries/System.Web.HttpUtility/src/System/Web/Util/HttpEncoder.cs

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -489,58 +489,6 @@ internal static byte[] UrlEncode(string str, Encoding e)
489489
: bytes;
490490
}
491491

492-
// Helper to encode the non-ASCII url characters only
493-
private static string UrlEncodeNonAscii(string str, Encoding e)
494-
{
495-
Debug.Assert(!string.IsNullOrEmpty(str));
496-
Debug.Assert(e != null);
497-
byte[] bytes = e.GetBytes(str);
498-
byte[] encodedBytes = UrlEncodeNonAscii(bytes, 0, bytes.Length);
499-
return Encoding.ASCII.GetString(encodedBytes);
500-
}
501-
502-
private static byte[] UrlEncodeNonAscii(byte[] bytes, int offset, int count)
503-
{
504-
int cNonAscii = 0;
505-
506-
// count them first
507-
for (int i = 0; i < count; i++)
508-
{
509-
if (IsNonAsciiByte(bytes[offset + i]))
510-
{
511-
cNonAscii++;
512-
}
513-
}
514-
515-
// nothing to expand?
516-
if (cNonAscii == 0)
517-
{
518-
return bytes;
519-
}
520-
521-
// expand not 'safe' characters into %XX, spaces to +s
522-
byte[] expandedBytes = new byte[count + cNonAscii * 2];
523-
int pos = 0;
524-
525-
for (int i = 0; i < count; i++)
526-
{
527-
byte b = bytes[offset + i];
528-
529-
if (IsNonAsciiByte(b))
530-
{
531-
expandedBytes[pos++] = (byte)'%';
532-
expandedBytes[pos++] = (byte)HexConverter.ToCharLower(b >> 4);
533-
expandedBytes[pos++] = (byte)HexConverter.ToCharLower(b);
534-
}
535-
else
536-
{
537-
expandedBytes[pos++] = b;
538-
}
539-
}
540-
541-
return expandedBytes;
542-
}
543-
544492
[Obsolete("This method produces non-standards-compliant output and has interoperability issues. The preferred alternative is UrlEncode(*).")]
545493
[return: NotNullIfNotNull(nameof(value))]
546494
internal static string? UrlEncodeUnicode(string? value)

0 commit comments

Comments
 (0)