Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Gunicorn raise encoding error #7010

Closed
wants to merge 1 commit into from

Conversation

zhaoyongjie
Copy link
Member

@zhaoyongjie zhaoyongjie commented Mar 12, 2019

according to:
#5377
benoitc/gunicorn#1778

on Python3 gunicorn encoding header by ascii, not support 'utf-8-sig' charset,
image, so we need replace utf-8-sig charset for header encoding

@codecov-io
Copy link

codecov-io commented Mar 12, 2019

Codecov Report

Merging #7010 into master will increase coverage by 2.92%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7010      +/-   ##
==========================================
+ Coverage   64.46%   67.39%   +2.92%     
==========================================
  Files         421      422       +1     
  Lines       20521    23902    +3381     
  Branches     2245     2478     +233     
==========================================
+ Hits        13229    16108    +2879     
- Misses       7165     7665     +500     
- Partials      127      129       +2
Impacted Files Coverage Δ
superset/views/base.py 71.15% <100%> (+2.04%) ⬆️
superset/assets/src/explore/controls.jsx 37.03% <0%> (-5.37%) ⬇️
.../src/dashboard/components/RefreshIntervalModal.jsx 65.21% <0%> (-3.54%) ⬇️
...rset/assets/src/dashboard/components/SaveModal.jsx 44.82% <0%> (-1.33%) ⬇️
...et/assets/src/dashboard/reducers/dashboardState.js 94% <0%> (-0.29%) ⬇️
superset/connectors/druid/views.py 66.15% <0%> (-0.07%) ⬇️
...t/assets/src/dashboard/reducers/getInitialState.js 0% <0%> (ø) ⬆️
...ssets/src/dashboard/containers/DashboardHeader.jsx 100% <0%> (ø) ⬆️
...migrations/versions/fb13d49b72f9_better_filters.py 53.44% <0%> (ø)
superset/sql_parse.py 99.2% <0%> (+0.06%) ⬆️
... and 35 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6a4d507...e142a0e. Read the comment docs.

@kristw kristw added the !deprecated-label:bug Deprecated label - Use #bug instead label Mar 13, 2019
@@ -320,7 +320,8 @@ class CsvResponse(Response):
"""
Override Response to take into account csv encoding from config.py
"""
charset = conf.get('CSV_EXPORT').get('encoding', 'utf-8')
_charset = conf.get('CSV_EXPORT').get('encoding', 'utf-8')
charset = 'utf-8' if _charset.lower() == 'utf-8-sig' else _charset
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of interest why are you using the utf-8-sig encoding rather than utf-8?

Copy link
Member Author

@zhaoyongjie zhaoyongjie Mar 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utf-8-sig is utf-8 encoding with BOM, and this is microsoft Excel detect utf-8 encoding.
In this scenarios, if use Excel open to east asian charset by Excel without BOM, excel show garbled.

@kristw kristw changed the title fix Gunicorn raise encoding error fix: Gunicorn raise encoding error Mar 19, 2019
@zhaoyongjie zhaoyongjie reopened this Mar 29, 2019
@zhaoyongjie zhaoyongjie deleted the fix_gunicorn_encoding branch September 21, 2020 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
!deprecated-label:bug Deprecated label - Use #bug instead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants