Modify ↓
Opened 5 months ago
Closed 4 weeks ago
#10848 closed defect (duplicate)
Encode data as utf-8 during csv export
| Reported by: | anonymous | Owned by: | rjollos |
|---|---|---|---|
| Priority: | normal | Component: | TracHoursPlugin |
| Severity: | normal | Keywords: | |
| Cc: | Trac Release: |
Description (last modified by rjollos)
If the database utf-8 encoded data is used it cannot be exported as the csvwriter will convert to ascii automatically.
Below is a small fix to solve the problem:
-
hours.py
old new 1015 1015 1016 1016 for groupname, results in data['groups']: 1017 1017 if groupname: 1018 writer.writerow( unicode(groupname).encode('utf-8'))1019 writer.writerow([ unicode(header['label']).encode('utf-8')for header in data['headers']])1018 writer.writerow(groupname) 1019 writer.writerow([header['label'] for header in data['headers']]) 1020 1020 for result in results: 1021 writer.writerow([ unicode(result[header['name']]).encode('utf-8')1021 writer.writerow([result[header['name']] 1022 1022 for header in data['headers']]) 1023 1023 writer.writerow([])
Attachments (1)
Change History (4)
Changed 5 months ago by anonymous
comment:1 Changed 4 weeks ago by rjollos
- Description modified (diff)
comment:2 Changed 4 weeks ago by rjollos
- Status changed from new to assigned
comment:3 Changed 4 weeks ago by rjollos
- Resolution set to duplicate
- Status changed from assigned to closed
Note: See
TracTickets for help on using
tickets.


It looks like the patch is backwards, but otherwise looks good.