mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
Remove unnecessary code for force_encoding
Since Rack 2 requires Ruby 2.2+, the extra logic for determining string encoding is no longer necessary. Outdated comments were also removed.
This commit is contained in:
parent
7b7043cde3
commit
6b96449a6e
1 changed files with 13 additions and 20 deletions
|
@ -1743,14 +1743,8 @@ module Sinatra
|
|||
end
|
||||
end
|
||||
|
||||
# Fixes encoding issues by
|
||||
# * defaulting to UTF-8
|
||||
# * casting params to Encoding.default_external
|
||||
#
|
||||
# The latter might not be necessary if Rack handles it one day.
|
||||
# Keep an eye on Rack's LH #100.
|
||||
def force_encoding(*args) settings.force_encoding(*args) end
|
||||
if defined? Encoding
|
||||
# Force data to specified encoding. It defaults to settings.default_encoding
|
||||
# which is UTF-8 by default
|
||||
def self.force_encoding(data, encoding = default_encoding)
|
||||
return if data == settings || data.is_a?(Tempfile)
|
||||
if data.respond_to? :force_encoding
|
||||
|
@ -1762,9 +1756,8 @@ module Sinatra
|
|||
end
|
||||
data
|
||||
end
|
||||
else
|
||||
def self.force_encoding(data, *) data end
|
||||
end
|
||||
|
||||
def force_encoding(*args) settings.force_encoding(*args) end
|
||||
|
||||
reset!
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue