Actions
Defect #7096
closedCSV Issues Export + Ruby 1.9 + Thin + non-ascii characters causes "invalid byte sequence in US-ASCII"
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Ruby support
Target version:
-
Start date:
2010-12-11
Due date:
% Done:
0%
Estimated time:
Resolution:
Affected version:
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
Actions