Skip to Content
Menu
This question has been flagged
3007 Views

Hi,

I have a controller in Odoo 12 that generates and download a txt file, but i need to be in ANSI and it generates in UTF-8, my controller code is:

def csvdownload(self, rec_id, tipo_nomina, **kw):        

csv = http.request.env['nomina']._csv_download({ 'rec_id': rec_id, 'tipo_nomina': tipo_nomina })        

filename = "%s-SIGEF.txt" % (tipo_nomina)        

return request.make_response(csv, [ ('Content-Type', 'text/plain;charset=US-ASCII'), ('Content-Disposition', 'attachment; filename="%s"' % (filename)) ])

I specify charset I want but still generating on UTF-8, 

is there any way to do what i need?

Avatar
Discard