Opened 11 years ago

Last modified 11 years ago

#10848 closed defect

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

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

Description (last modified by Ryan J Ollos)

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  
    10151015
    10161016        for groupname, results in data['groups']:
    10171017            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']])
    10201020            for result in results:
    1021                 writer.writerow([unicode(result[header['name']]).encode('utf-8')
     1021                writer.writerow([result[header['name']]
    10221022                                 for header in data['headers']])
    10231023            writer.writerow([])

Change History (2)

Changed 11 years ago by anonymous

Attachment: trachours.patch added

comment:1 Changed 11 years ago by Ryan J Ollos

Description: modified (diff)
Note: See TracTickets for help on using tickets.