Modify

Opened 11 years ago

Closed 11 years ago

#10848 closed defect (duplicate)

Encode data as utf-8 during csv export

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

Attachments (1)

trachours.patch (782 bytes) - added by anonymous 11 years ago.

Download all attachments as: .zip

Change History (4)

Changed 11 years ago by anonymous

Attachment: trachours.patch added

comment:1 Changed 11 years ago by Ryan J Ollos

Description: modified (diff)

comment:2 Changed 11 years ago by Ryan J Ollos

Status: newassigned

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

comment:3 Changed 11 years ago by Ryan J Ollos

Resolution: duplicate
Status: assignedclosed

Duplicate of #10233.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.