aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorDamien Mathieu <42@dmathieu.com>2011-06-14 09:59:18 +0200
committerDamien Mathieu <42@dmathieu.com>2011-06-14 14:34:30 +0200
commit383d56b5ee5da7d6e34e75677e96e0f342aa470d (patch)
treeb3ec99670c9ef4e94702e3f921553aff66adcfad /actionpack/test
parent954359b9c260f0e1265237c20bb3e4834a11fb9a (diff)
downloadrails-383d56b5ee5da7d6e34e75677e96e0f342aa470d.tar.gz
rails-383d56b5ee5da7d6e34e75677e96e0f342aa470d.tar.bz2
rails-383d56b5ee5da7d6e34e75677e96e0f342aa470d.zip
encode the uploaded file's name in the default external encoding - Closes #869
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/dispatch/uploaded_file_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/uploaded_file_test.rb b/actionpack/test/dispatch/uploaded_file_test.rb
index e2a7f1bad7..5e0c5fb21e 100644
--- a/actionpack/test/dispatch/uploaded_file_test.rb
+++ b/actionpack/test/dispatch/uploaded_file_test.rb
@@ -12,6 +12,18 @@ module ActionDispatch
uf = Http::UploadedFile.new(:filename => 'foo', :tempfile => Object.new)
assert_equal 'foo', uf.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"
+ uf = Http::UploadedFile.new(:filename => 'foo', :tempfile => Object.new)
+ assert "UTF-8", uf.original_filename.encoding.to_s
+ end
+ end
def test_content_type
uf = Http::UploadedFile.new(:type => 'foo', :tempfile => Object.new)