Opened 11 years ago

Last modified 11 years ago

#10848 closed defect

Encode data as utf-8 during csv export — at Initial Version

Reported by: anonymous Owned by: Ryan J Ollos
Priority: normal Component: TracHoursPlugin
Severity: normal Keywords:
Cc: Trac Release:

Description

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 2013-02-01 11:14:35.059829098 +0100 +++ hours.py.no-utf8 2013-01-30 15:22:38.300399554 +0100 @@ -1015,10 +1015,10 @@

for groupname, results in datagroups?:

if groupname:

  • writer.writerow(unicode(groupname).encode('utf-8'))
  • writer.writerow([unicode(headerlabel?).encode('utf-8') for header in dataheaders?])

+ writer.writerow(groupname) + writer.writerow([headerlabel? for header in dataheaders?])

for result in results:

  • writer.writerow([unicode(result[headername?]).encode('utf-8')

+ writer.writerow([result[headername?]

for header in dataheaders?])

writer.writerow([])

Change History (1)

Changed 11 years ago by anonymous

Attachment: trachours.patch added
Note: See TracTickets for help on using tickets.