views:

64

answers:

1

Hi,

I m having a porblem.I m exporting data to an excel in my django admin.The functionality is fine until some special characters are not there.

I have a text " ACTPrinter ★ Print to iPhone " when i try to export this to an csv file , it gives an error

UnicodeEncodeError at /admin/core/wappubfilter/

'ascii' codec can't encode character u'\u2605' in position 11: ordinal not in range(128)

any idea how to solve it.I tried giving the tring under unicode but not working

+2  A: 

you should convert all the data into utf-8. this is done like this:

writer.writerow(
        [unicode(s).encode("utf-8") for s in data]
    )
renton
thanks man my problem is solved
ha22109