Defect #7096
closedCSV Issues Export + Ruby 1.9 + Thin + non-ascii characters causes "invalid byte sequence in US-ASCII"
0%
Description
When exporting an issue list to CSV, if the issue list has a non-us ascii character, a 500 is produced with this in the logs:
ArgumentError (invalid byte sequence in US-ASCII): <internal:prelude>:8:in `synchronize' thin (1.2.7) lib/thin/connection.rb:76:in `block in pre_process' thin (1.2.7) lib/thin/connection.rb:74:in `catch' thin (1.2.7) lib/thin/connection.rb:74:in `pre_process' thin (1.2.7) lib/thin/connection.rb:57:in `process' thin (1.2.7) lib/thin/connection.rb:42:in `receive_data' eventmachine (0.12.10) lib/eventmachine.rb:256:in `run_machine' eventmachine (0.12.10) lib/eventmachine.rb:256:in `run' thin (1.2.7) lib/thin/backends/base.rb:57:in `start' thin (1.2.7) lib/thin/server.rb:156:in `start' thin (1.2.7) lib/thin/controllers/controller.rb:80:in `start' thin (1.2.7) lib/thin/runner.rb:177:in `run_command' thin (1.2.7) lib/thin/runner.rb:143:in `run!' thin (1.2.7) bin/thin:6:in `<main>'
Changing this in source:/trunk/app/controllers/issues_controller.rb@4515 fixed it, at least in that it does the export (non-ascii characters still don't seem quite right but they never really do and at least it exports).
Index: app/controllers/issues_controller.rb
===================================================================
--- app/controllers/issues_controller.rb (revision 4515)
+++ app/controllers/issues_controller.rb (working copy)
@@ -92,1 +92,1 @@
- format.csv { send_data(issues_to_csv(@issues, @project), :type => 'text/csv; header=present', :filename => 'export.csv') }
+ format.csv { send_data(issues_to_csv(@issues, @project).force_encoding('ASCII-8BIT'), :type => 'text/csv; header=present', :filename => 'export.csv') }
As visible above, just added .force_encoding()
there.
Related issues
Updated by Jean-Philippe Lang about 14 years ago
- Category set to Ruby support
FYI, ruby 1.9 is not supported. See RedmineInstall.
Updated by Kioma Aldecoa about 14 years ago
I know, but we have it working pretty well in 1.9 with a few patches like this. Just thought I would post them here for when it does become supported.
Updated by Jean-Baptiste Barth about 14 years ago
- Target version set to Unplanned backlogs
- Affected version (unused) set to devel
Yes, but for now, ruby 1.8.6 and 1.8.7 are still the main ruby versions supported (often the default choice in stable distributions). If we do this directly, most people would see undefined method `force_encoding' for "...":String
, not good. There's something going on in #4050 but it's not a priority for 1.1.0.
Updated by Mischa The Evil about 14 years ago
"Corrected" the issue description.
Updated by Toshi MARUYAMA over 13 years ago
- Assignee set to Toshi MARUYAMA
- Target version changed from Unplanned backlogs to 1.3.0
Updated by Toshi MARUYAMA about 13 years ago
- Target version changed from 1.3.0 to Unplanned backlogs
Updated by Toshi MARUYAMA over 9 years ago
- Status changed from New to Closed
- Assignee deleted (
Toshi MARUYAMA)
This issue is too old.
Redmine 1.4 and Redmine 2.x support Ruby >= 1.9.
Updated by Toshi MARUYAMA over 9 years ago
- Target version deleted (
Unplanned backlogs)