diff options
author | Damien Mathieu <42@dmathieu.com> | 2011-06-14 16:58:06 +0200 |
---|---|---|
committer | Damien Mathieu <42@dmathieu.com> | 2011-06-14 17:01:33 +0200 |
commit | 383fd143bf6b81d3a1352ddaebb7b4e8beac8b37 (patch) | |
tree | b7fe92fbb0af83d3fb757a09773a903105849182 /actionpack | |
parent | 383d56b5ee5da7d6e34e75677e96e0f342aa470d (diff) | |
download | rails-383fd143bf6b81d3a1352ddaebb7b4e8beac8b37.tar.gz rails-383fd143bf6b81d3a1352ddaebb7b4e8beac8b37.tar.bz2 rails-383fd143bf6b81d3a1352ddaebb7b4e8beac8b37.zip |
all requests are utf-8. Don't use the external encoding.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/http/upload.rb | 5 | ||||
-rw-r--r-- | actionpack/test/dispatch/uploaded_file_test.rb | 7 |
2 files changed, 3 insertions, 9 deletions
diff --git a/actionpack/lib/action_dispatch/http/upload.rb b/actionpack/lib/action_dispatch/http/upload.rb index ed6140dac5..a15ad28f16 100644 --- a/actionpack/lib/action_dispatch/http/upload.rb +++ b/actionpack/lib/action_dispatch/http/upload.rb @@ -33,10 +33,9 @@ module ActionDispatch 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 diff --git a/actionpack/test/dispatch/uploaded_file_test.rb b/actionpack/test/dispatch/uploaded_file_test.rb index 5e0c5fb21e..44c15694f7 100644 --- a/actionpack/test/dispatch/uploaded_file_test.rb +++ b/actionpack/test/dispatch/uploaded_file_test.rb @@ -14,12 +14,7 @@ module ActionDispatch 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 |