Commit 2951f2c 1 parent a99fe2c commit 2951f2c Copy full SHA for 2951f2c
File tree 2 files changed +10
-9
lines changed
2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -20,13 +20,7 @@ def mime_type(str)
20
20
# :nodoc:
21
21
def charset ( str )
22
22
md = str . to_s . match CHARSET_RE
23
- md &&= md [ 1 ] . to_s . strip . gsub ( /^"|"$/ , "" )
24
-
25
- begin
26
- md if Encoding . find ( md )
27
- rescue ArgumentError
28
- nil
29
- end
23
+ md && md [ 1 ] . to_s . strip . gsub ( /^"|"$/ , "" )
30
24
end
31
25
end
32
26
end
Original file line number Diff line number Diff line change @@ -35,11 +35,18 @@ def to_s
35
35
36
36
fail StateError , "body is being streamed" unless @streaming . nil?
37
37
38
+ # see issue 312
39
+ begin
40
+ encoding = Encoding . find @encoding
41
+ rescue ArgumentError
42
+ encoding = Encoding ::BINARY
43
+ end
44
+
38
45
begin
39
46
@streaming = false
40
- @contents = "" . force_encoding ( @ encoding)
47
+ @contents = "" . force_encoding ( encoding )
41
48
while ( chunk = @client . readpartial )
42
- @contents << chunk . force_encoding ( @ encoding)
49
+ @contents << chunk . force_encoding ( encoding )
43
50
end
44
51
rescue
45
52
@contents = nil
You can’t perform that action at this time.
0 commit comments