Project

General

Profile

Actions

Defect #7096

closed

CSV Issues Export + Ruby 1.9 + Thin + non-ascii characters causes "invalid byte sequence in US-ASCII"

Added by Kioma Aldecoa almost 14 years ago. Updated over 9 years ago.

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

Related to Redmine - Defect #7039: CSV export. Line breaks. ExcelClosed2010-12-03

Actions
Related to Redmine - Defect #8368: Bad decimal separator in time entry CSVClosedToshi MARUYAMA2011-05-13

Actions
Related to Redmine - Defect #6621: Multibyte symbols are wrongly displayed in issues CSV export (ISO-8859)Closed2010-10-11

Actions
Related to Redmine - Defect #8549: Export CSV has character encoding errorClosedToshi MARUYAMA2011-06-07

Actions
Related to Redmine - Feature #4050: Ruby 1.9 supportClosed2009-10-18

Actions
Actions #1

Updated by Jean-Philippe Lang almost 14 years ago

  • Category set to Ruby support

FYI, ruby 1.9 is not supported. See RedmineInstall.

Actions #2

Updated by Kioma Aldecoa almost 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.

Actions #3

Updated by Jean-Baptiste Barth almost 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.

Actions #4

Updated by Mischa The Evil almost 14 years ago

"Corrected" the issue description.

Actions #5

Updated by Toshi MARUYAMA over 13 years ago

  • Assignee set to Toshi MARUYAMA
  • Target version changed from Unplanned backlogs to 1.3.0
Actions #6

Updated by Toshi MARUYAMA about 13 years ago

  • Target version changed from 1.3.0 to Unplanned backlogs
Actions #7

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.

Actions #8

Updated by Toshi MARUYAMA over 9 years ago

  • Target version deleted (Unplanned backlogs)
Actions

Also available in: Atom PDF