#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:


    old new  
    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([]) 

Attachments (1)

trachours.patch (782 bytes) - added by anonymous 18 months ago.

Download all attachments as: .zip

Change History (4)

Changed 18 months ago by anonymous

comment:1 Changed 15 months ago by rjollos

  • Description modified (diff)

comment:2 Changed 14 months ago by rjollos

  • Status changed from new to assigned

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

comment:3 Changed 14 months ago by rjollos

  • Resolution set to duplicate
  • Status changed from assigned to closed

Add Comment

Modify Ticket

as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from rjollos. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.