See related issue : #869
Thanks for the pull request, but there are a few changes still required here:
1) AS provides a method on the string called encoding_aware? that returns true if the encoding system is available. please use it instead of respond_to.
2) We cannot hardcode it to utf8. We should probably check default_external or whatever the current code in AD is using for encoding the rest of the request. force_encoding in general is not an option.
Oh ok, I saw the encoding_aware method but as it didn't respond in irb in 1.8, I thought it was only 1.9.
I didn't think it would be implemented by AS. I'll use it.
I'll also look into not hardcoding it.
encode the uploaded file's name in the default external encoding - Cl…
I have pushed again in my fork with your suggestions.
Much cleaner by moving it to its own method. :)
Let's wait for @wycats feedback. Although Rails is using default_external for loading templates, it seems we are hardcoding the request to be UTF-8 (which kinda makes sense). So actually your first implementation would be more correct according to this commit from Yehuda:
Sorry about that. :(
all requests are utf-8. Don't use the external encoding.
Shoud not there be assert_equal instead of plain assert?
Surely it should, my bad. Do you want to make a pull request ?