Skip to content

Commit c285b7d

Browse files
authored
ec2plugin: fallback to utf8 if response encoding not set (#278)
fixes #277
1 parent 2d0e1f8 commit c285b7d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sdk/src/Core/Plugins/EC2Plugin.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ protected virtual string DoRequest(string url, HttpMethod method, Dictionary<str
142142
throw new Exception("Unable to complete the request successfully");
143143
}
144144

145-
var encoding = Encoding.GetEncoding(response.ContentEncoding);
145+
var encoding = !string.IsNullOrEmpty(response.ContentEncoding)
146+
? Encoding.GetEncoding(response.ContentEncoding)
147+
: Encoding.UTF8;
146148

147149
using (var streamReader = new StreamReader(response.GetResponseStream(), encoding))
148150
{

0 commit comments

Comments
 (0)