Skip to content

Commit

Permalink
Remove useless $KCODE dependency in 1.9.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshi Nakamura committed Apr 8, 2011
1 parent 759e1a4 commit 6d7375b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/httpclient/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,17 @@ def set_response_header
set('Last-Modified', @body_date.httpdate)
end
if self['Content-Type'].empty?
set('Content-Type', "#{ @body_type || 'text/html' }; charset=#{ charset_label(@body_charset || $KCODE) }")
set('Content-Type', "#{ @body_type || 'text/html' }; charset=#{ charset_label }")
end
end

def charset_label(charset)
CHARSET_MAP[charset] || 'us-ascii'
def charset_label
# TODO: should handle response encoding for 1.9 correctly.
if RUBY_VERSION > "1.9"
CHARSET_MAP[@body_charset] || 'us-ascii'
else
CHARSET_MAP[@body_charset || $KCODE] || 'us-ascii'
end
end
end

Expand Down

0 comments on commit 6d7375b

Please sign in to comment.