self.link_1.url=app_tables.test.search().to_csv().url
The CSV file downloaded by clicking through the link is not UTF-8 encoded!!!
Local open CSV file, inside the Chinese content is garbled.
Does anybody know how to solve this?
are you opening the file in excel?
If you are, then this might be a problem with excel and not the encoding of the to_csv()
method.
https://excel.officetuts.net/examples/how-to-import-csv-file-that-uses-utf-8-encoding
Your method works, but the user will simply double-click the CSV file to open it.
Is it possible to configure the encoding of the CSV download file if it cannot be exported from the server?
It might be better to write the file to an excel file in the first instance before sending it to the client to be downloaded. That way you don’t have to worry about the excel csv utf8 bug.
This can be done in the full python 3 runtime (available on the individual plan).
If you look at the list of packages there are two that i’d try: pandas or XlsxWriter.
pandas has a to_excel
method, and you can give it an encoding argument.
If you are on the free plan you can use these packages via uplink.