Reputation: 2351
When I log the request in my frontend, I see characters like this:
PKS/L'�I�rrQUsers/my/local/dev_env/django_app/webapp/webapp/csvs/mailMagaOutput.csv会員id,e-mail,お名前(姓),お名前(名),購入回数
And the response logs the rest of the CSV files I am trying to log as the way they should look... Does this mean that I am not properly encrypting them?
The response I am sending (from Django):
zipped_file = zipfile.ZipFile("csvOutput.zip", 'w')
zipped_file.write(sms_file_path)
zipped_file.write(mail_maga_file_path)
zipped_file.close()
response_file = open('csvOutput.zip', 'rb')
response = HttpResponse(response_file, content_type="application/zip")
response['Content-Disposition'] = 'attachment; filename=csvOutput.zip"'
If I try to unzip the file that python generates on the server, it works just fine. When I try to unzip it locally, I am getting:
tar: Too-small extra data: Need at least 4 bytes, but only found 3 bytes
Note: the zip file contains two CSV files, those CSV files, are in two different Japanese encodings, shift_jis
and shiftjisx0213
Upvotes: 0
Views: 355
Reputation: 82765
Instead of having the full path in the zipfile can you just zip the CSV files only?
EX:
import os
import zipfile
zipped_file = zipfile.ZipFile("csvOutput.zip", 'w')
os.chdir("/path/to/ CSV file path ")
zipped_file.write('mail_maga_file.csv')
zipped_file.write('sms_file.csv')
zipped_file.close()
Upvotes: 1