This repository was archived by the owner on Apr 10, 2018. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ internal static class RestResponseExtensions
1111 /// <summary>
1212 /// The default encoding, when none could be detected
1313 /// </summary>
14- private static readonly Encoding _defaultEncoding = Encoding . GetEncoding ( "iso-8859-15" ) ;
14+ private static readonly Encoding _defaultEncoding = Encoding . UTF8 ;
1515
1616 /// <summary>
1717 /// Converts a byte array to a string, using its byte order mark to convert it to the right encoding.
@@ -26,7 +26,7 @@ public static string GetStringContent(this IRestResponse response)
2626 if ( buffer == null )
2727 return string . Empty ;
2828
29- // Ansi as default
29+ // UTF-8 as default
3030 var encoding = _defaultEncoding ;
3131
3232 if ( buffer . Length == 0 )
@@ -40,11 +40,7 @@ FE FF UTF-16 big endian
4040 00 00 FE FF UTF-32, big-endian
4141 */
4242
43- if ( buffer . Length > 2 && buffer [ 0 ] == 0xef && buffer [ 1 ] == 0xbb && buffer [ 2 ] == 0xbf )
44- {
45- encoding = Encoding . UTF8 ;
46- }
47- else if ( buffer . Length > 1 && buffer [ 0 ] == 0xfe && buffer [ 1 ] == 0xff )
43+ if ( buffer . Length > 1 && buffer [ 0 ] == 0xfe && buffer [ 1 ] == 0xff )
4844 {
4945 encoding = Encoding . Unicode ;
5046 }
You can’t perform that action at this time.
0 commit comments