@@ -13,20 +13,6 @@ namespace Microsoft.PowerShell.Commands
13
13
{
14
14
internal static class ContentHelper
15
15
{
16
- #region Constants
17
-
18
- // default codepage encoding for web content. See RFC 2616.
19
- private const string _defaultCodePage = "ISO-8859-1" ;
20
-
21
- #endregion Constants
22
-
23
- #region Fields
24
-
25
- // used to split contentType arguments
26
- private static readonly char [ ] s_contentTypeParamSeparator = { ';' } ;
27
-
28
- #endregion Fields
29
-
30
16
#region Internal Methods
31
17
32
18
internal static string GetContentType ( HttpResponseMessage response )
@@ -37,33 +23,9 @@ internal static string GetContentType(HttpResponseMessage response)
37
23
38
24
internal static Encoding GetDefaultEncoding ( )
39
25
{
40
- return GetEncodingOrDefault ( ( string ) null ) ;
41
- }
42
-
43
- internal static Encoding GetEncoding ( HttpResponseMessage response )
44
- {
45
- // ContentType may not exist in response header.
46
- string charSet = response . Content . Headers . ContentType ? . CharSet ;
47
- return GetEncodingOrDefault ( charSet ) ;
48
- }
49
-
50
- internal static Encoding GetEncodingOrDefault ( string characterSet )
51
- {
52
- // get the name of the codepage to use for response content
53
- string codepage = ( string . IsNullOrEmpty ( characterSet ) ? _defaultCodePage : characterSet ) ;
54
- Encoding encoding = null ;
55
-
56
- try
57
- {
58
- encoding = Encoding . GetEncoding ( codepage ) ;
59
- }
60
- catch ( ArgumentException )
61
- {
62
- // 0, default code page
63
- encoding = Encoding . GetEncoding ( 0 ) ;
64
- }
65
-
66
- return encoding ;
26
+ // default codepage encoding for web content. See RFC 2616.
27
+ Encoding encoding = Encoding . GetEncoding ( "ISO-8859-1" ) ;
28
+ return encoding ;
67
29
}
68
30
69
31
internal static StringBuilder GetRawContentHeader ( HttpResponseMessage response )
@@ -206,7 +168,7 @@ private static string GetContentTypeSignature(string contentType)
206
168
if ( string . IsNullOrEmpty ( contentType ) )
207
169
return null ;
208
170
209
- string sig = contentType . Split ( s_contentTypeParamSeparator , 2 ) [ 0 ] . ToUpperInvariant ( ) ;
171
+ string sig = contentType . Split ( ';' , 2 ) [ 0 ] . ToUpperInvariant ( ) ;
210
172
return ( sig ) ;
211
173
}
212
174
0 commit comments