Comments (7)
Thanks!
I think replacing the current export behavior with this is best.
from tablib.
Any objections?
from tablib.
Done.
from tablib.
What ever happened with this? I'm using tablib==3.2.0 and not finding anything with utf-8-sig and excel is still unable to show the emojis that are in the file correctly.
from tablib.
When you export with tablib in csv, you get an unicode result, so AFAIR it's your business to write it in a file with the proper encoding.
from tablib.
I'm using tablib via django-tables2 and this is what I had to do to get the encoding bytes into the file.
if request.GET.get('_export', None):
export = TableExport(export_format=request.GET['_export'], table=table)
response = HttpResponse(content_type=export.content_type())
filename=f"{self.export_name}.{request.GET['_export']}"
response["Content-Disposition"] = f'attachment; filename="{filename}"'
# These 3 bytes at the beginning of the file make excel happy with the emojis
response.write(b'\xef\xbb\xbf')
response.write(export.export())
return response
from tablib.
You could write a single write line with response.write(export.export().encode('utf-8-sig'))
from tablib.
Related Issues (20)
- Different file formats require user to know if file should be opened binary or not HOT 1
- Suggestion: Option to normalize treatment of missing values
- InvalidDiemensionError raise when certain string literals are used to instanciate a Dataset object HOT 2
- Support Mac OS LF char for csv HOT 5
- Databook unable to load xls HOT 4
- KeyError reading yaml file HOT 3
- ODS exports numbers as text? HOT 4
- Add <tbody> tags to html output HOT 5
- Excel file is wrongly parsed. Surely openpyxl bug HOT 2
- Please make markuppy test dependency optional HOT 2
- Addition of ElementTree changes HTML output HOT 13
- `InvalidDimensions` for `.xlsx` file from Google Drive
- Extracting hidden url from hyperlink from .xlsx HOT 1
- Add support for importing ODS content
- appending rows when there are dynamic columns HOT 9
- dynamic elements when adding rows
- Output formatter corrupts original data HOT 3
- DeprecationWarning: datetime.datetime.utcnow() HOT 1
- Inserting column with insert_col fails if dataset contains 0 rows HOT 3
- Removing the html extra dependency should be considered a breaking change HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tablib.