Multilanguage problem with csv files

Bug #507816 reported by Rafael Lorenzo
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GTimeLog
Confirmed
Medium
Unassigned

Bug Description

Hi,

When I use the option: export to a spreadsheet, it doesn't work very well.

I found a manual solution. Opening the /tmp/xxx.csv file and changing "," -> ";" and "." -> ","

The main problem is that, here in Spain, we don't use "." to separate the decimal part of a number, we use ','

I guess this has something to do with i18n support.

I suggest two posible solutions:
 - Creating the csv file considering i18n.
 - Asking where to save the file instead of opening it directly.

Tags: csv i18n
Revision history for this message
Rafael Lorenzo (rlorenzo) wrote :

Hi,

I've made a patch to solve just the commented problem. Anyway, the rest of the code could take advantage of this to turn it more general.

Thanks,
Rafael Lorenzo.

Changed in gtimelog:
status: New → Confirmed
Revision history for this message
Marius Gedminas (mgedmin) wrote :

Thank you for the patch!

I'm a bit worried that the global locale.setlocale() call may have unintended consequences somewhere; I'll try to do some testing to make sure it's ok.

Revision history for this message
Rafael Lorenzo (rlorenzo) wrote :

In fact, thank YOU for such a useful program.

The only intention of this patch is to show you an example of how you can do it. I'm sure you'll do it much better.

Best regards,
Rafael Lorenzo.

Revision history for this message
Marius Gedminas (mgedmin) wrote :

Lithuanian also uses commas as a decimal separator, but when I try this patch I get an open-office CSV import dialog that by default treats both commas and semicolons as field separators, so I get twice as much fields unless I fiddle with the defaults.

Now I'm not sure the defaults are actually default and not something that I've previously chosen to use and had OpenOffice.org remember :(

Maybe gtimelog should use something more sane than CSV, e.g. OpenOffice.org's spreadsheet XML, or perhaps OO.o can open HTML files with a <table> in them, like MS Excel can?

Revision history for this message
Rafael Lorenzo (rlorenzo) wrote :

The default is to use commas so you have to unselect that and select semicolons...

Anyway, I agree it would be better to use other format.

Revision history for this message
Rafael Lorenzo (rlorenzo) wrote :

I tried gnumeric instead of openoffice and it opens without any questions. I think you can change default program for this.

Barry Warsaw (barry)
summary: - Multilanguage problem with cvs files
+ Multilanguage problem with csv files
tags: added: csv
removed: cvs
Revision history for this message
Barry Warsaw (barry) wrote :

What do you think about simply adding a configuration option to control the CSV delimiter? You could then subclass from the csv.excel dialect and override the delimiter attribute? We'd leave it as comma by default. Let's call the option "csv_delimiter".

Changed in gtimelog:
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.