gregbell/active_admin — pull request #3097 by dtaniwaki (2014-04-21 08:02:01+00:00)
Title: Workaround for CSV#generate encoding issue.

Hi,
It seems downloading Shift-JIS encoded csv doesn't work because it is compatible with UTF-8. However, to load Japanese characters in Excel, it needs to be Shift-JIS. Please take a look at the following code.

```
irb(main):002:0> s = CSV.generate(encoding: 'SJIS') do |csv|
csv << ['あ']
end
=> ["あ"]

irb(main):003:0> s
=> "あ\n"

irb(main):004:0> s.encoding
=> #
```

The string returned in the block of CSV#generate must be encoded as 'Shift-JIS'. Here's the related code in ruby stdlib.

http://ruby-doc.org/stdlib-1.9.2/libdoc/csv/rdoc/CSV.html#method-c-generate

Could you consider to merge this change as workaround?