Feature #34718

Auto guess file encoding when importing CSV file

Added by Go MAEDA 11 months ago. Updated 11 days ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Importers
Target version:5.0.0
Resolution:Fixed

Description

When importing a CSV file, file encoding is pre-selected according to general_csv_encoding in config/locales/*.yml. For example, "CP932" is selected by default when your language setting is Japanese.

I often use CSV files with UTF-8 encoding, but it's a bother to re-select UTF-8 in the encoding drop-down every time.

It would be nice if Redmine auto guesses the file encoding when importing a CSV file. Redmine already auto guess file encoding when displaying attached files or repository contents using Setting.repositories_encodings.

34718.patch Magnifier (4.27 KB) Go MAEDA, 2022-01-02 09:09

Associated revisions

Revision 21352
Added by Go MAEDA 11 days ago

Auto guess file encoding when importing CSV file (#34718).

Patch by Go MAEDA.

Revision 21353
Added by Go MAEDA 11 days ago

RuboCop: fix Style/RedundantSort in app/models/import.rb (#34718).

Revision 21354
Added by Go MAEDA 11 days ago

Fix wrong variable name in Import#set_default_settings (#34718).

History

#1 Updated by Go MAEDA 16 days ago

  • File 34718.patchMagnifier added
  • Target version set to Candidate for next major release

Here is a patch to implement this feature.

The patch guesses the encoding of CSV files by checking if the encoding is one of Setting.repositories_encodings. It fallbacks to general_csv_encoding ff the auto-guess fails.

#2 Updated by Mizuki ISHIKAWA 14 days ago

+1

#3 Updated by Go MAEDA 13 days ago

  • Target version changed from Candidate for next major release to 5.0.0

Setting the target version to 5.0.0.

#4 Updated by Go MAEDA 11 days ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch.

Also available in: Atom PDF