I ran into the same problem and I found in the Python documentation that the csv module has some Unicode issues ...
http://docs.python.org/library/csv.html?highlight=csv#module-csv ... with an attempt to getting around it with a wrapper ... http://docs.python.org/library/csv.html?highlight=csv#csv-examples ..., but I didn't try it myself (other priorities). If You give it a try, please provide feedback if it works, otherwise You can always fallback to constructing the csv 'by hand' in a template as proposed in the Django docs http://docs.djangoproject.com/en/dev/howto/outputting-csv/ Kindly Yours Marc On Aug 20, 12:06 pm, andreas schmid <a.schmi...@gmail.com> wrote: > hi, > > i successfully made a csv export view for a queryset but i have the > problem with some characters... > how can i encode the queryset passed to the csv writer to solve my problem? > > #my csvexport.py > > import csv > from django.http import HttpResponse > from django.contrib.auth.decorators import login_required > > from myapp.models import Project > > @login_required > def projects_csv(request): > > response = HttpResponse(mimetype='text/csv') > response['Content-Disposition'] = 'attachment; > filename=Projects.csv' > > csv_data = Project.objects.all() > > writer = csv.writer(response) > writer.writerow(['title' ,'area' , 'type', 'axis','beneficiary', > 'description', 'budget', 'already paid > amount ', > 'length', 'financing' , > 'total_amount_to_finance', 'percentage_to_pay' , > 'restamountto_pay', 'security', 'date']) > for project in csv_data: > writer.writerow([ project.title , project.area , > project.type, project.axis,project.beneficiary, > project.description, project.budget, > project.already_paid_amount, > project.length, project.financing, > project.total_amount_to_finance, project.percentage_to_pay_by_tis , > project.restamount_to_pay, > project.security, project.pub_date ]) > return response > > thank you... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---