提交 383fd143 编写于 作者: D Damien Mathieu

all requests are utf-8. Don't use the external encoding.

上级 383d56b5
......@@ -33,10 +33,9 @@ def size
private
def encode_filename(filename)
# Encode the filename in the default_external encoding, unless it is nil or we're in 1.8
# Encode the filename in the utf8 encoding, unless it is nil or we're in 1.8
if "ruby".encoding_aware? && filename
encoding = Encoding.default_external
filename.force_encoding(encoding)
filename.force_encoding("UTF-8").encode!
else
filename
end
......
......@@ -14,12 +14,7 @@ def test_original_filename
end
if "ruby".encoding_aware?
def test_filename_should_be_in_default_encoding
Encoding.default_external = "UTF-16LE"
uf = Http::UploadedFile.new(:filename => 'foo', :tempfile => Object.new)
assert "UTF-16LE", uf.original_filename.encoding.to_s
Encoding.default_external = "UTF-8"
def test_filename_should_be_in_utf_8
uf = Http::UploadedFile.new(:filename => 'foo', :tempfile => Object.new)
assert "UTF-8", uf.original_filename.encoding.to_s
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册