dosubot[bot] commented on issue #36374: URL: https://github.com/apache/superset/issues/36374#issuecomment-3601122640
<!-- Answer --> Superset’s CSV export uses the encoding you set in `CSV_EXPORT`, so `'utf-8-sig'` should work for Chinese characters. However, Excel and some spreadsheet apps sometimes misinterpret UTF-8 files, even with BOM, which leads to garbled text. Before downgrading Werkzeug, try opening the exported CSV in a text editor to check if the Chinese characters are correct—if they look fine there, the issue is with how Excel is reading the file, not Superset’s export logic. Also, make sure you’re opening the file in the Excel desktop app, not a browser or online viewer, as those often mishandle encodings[^1][^2]. If the text is garbled in the text editor too, then Superset may not be applying the encoding correctly, but the code paths show it should respect your config[^3][^4][^5][^6]. There’s no evidence that downgrading Werkzeug is the only solution, but there’s also no confirmed alternative fix for this issue in recent Superset versions[^7]. If you need a workaround, you can try importing the CSV into Excel using the “Data > From Text/CSV” wizard and manually selecting UTF-8 encoding. [^1]: [CSV export encoding issues and Excel interpretation](https://github.com/apache/superset/discussions/31463#discussioncomment-11577677) [^2]: [CSV export encoding and client-side factors](https://github.com/apache/superset/discussions/31416#discussioncomment-11541135) [^3]: [CSV_EXPORT config in Superset](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/config.py#L19-L876) [^4]: [CsvResponse encoding logic](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/views/base.py#L489-L495) [^5]: [ChartDataRestApi CSV export encoding](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/charts/data/api.py#L362-L389) [^6]: [CSV export command encoding](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/commands/sql_lab/export.py#L104-L134) [^7]: [No confirmed alternative fix for encoding issues](https://github.com/apache/superset/issues/20331#issuecomment-2073665836) <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/bd321004-54ce-4268-bb3c-e211fc234b6f?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/bd321004-54ce-4268-bb3c-e211fc234b6f?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/bd321004-54ce-4268-bb3c-e211fc234b6f?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/bd321004-54ce-4268-bb3c-e211fc234b6f?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/bd321004-54ce-4268-bb3c-e211fc234b6f?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/bd321004-54ce-4268-bb3c-e211fc234b6f?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/bd321004-54ce-4268-bb3c-e211fc234b6f?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=Superset%E2%80%99s%20CSV%20export%20uses%20the%20encoding%20you%20set%20in%20%60CSV_EXPORT%60%2C%20so%20%60%27utf-8-sig%27%60%20should%20work%20for%20Chinese%20characters.%20However%2C%20Excel%20and%20some%20spreadsheet%20apps%20sometimes%20misinterpret%20UTF-8%20files%2C%20even%20with%20BOM%2C%20which%20leads%20to%20garbled%20text.%20Before%20downgrading%20Werkzeug%2C%20try%20opening%20the%20exported%20CSV%20in%20a%20text%20editor%20to%20check%20if%20the%20Chinese%20characters%20are%20correct%E2%80%94if%20they%20look%20fine%20there%2C%20the%20issue%20is%20with%20how%20Excel%20is%20reading%20the%20file%2C%20not%20Superset%E2%80%99s%20export%20logic.%20Also%2C%20make%20sure%20you%E2%80%99re%20opening%20the%20file%20in%20the%20Excel%20desktop%20app%2 C%20not%20a%20browser%20or%20online%20viewer%2C%20as%20those%20often%20mishandle%20encodings%5B%5E1%5D%5B%5E2%5D.%0A%0AIf%20the%20text%20is%20garbled%20in%20the%20text%20editor%20too%2C%20then%20Superset%20may%20not%20be%20applying%20the%20encoding%20correctly%2C%20but%20the%20code%20paths%20show%20it%20should%20respect%20your%20config%5B%5E3%5D%5B%5E4%5D%5B%5E5%5D%5B%5E6%5D.%20There%E2%80%99s%20no%20evidence%20that%20downgrading%20Werkzeug%20is%20the%20only%20solution%2C%20but%20there%E2%80%99s%20also%20no%20confirmed%20alternative%20fix%20for%20this%20issue%20in%20recent%20Superset%20versions%5B%5E7%5D.%20If%20you%20need%20a%20workaround%2C%20you%20can%20try%20importing%20the%20CSV%20into%20Excel%20using%20the%20%E2%80%9CData%20%3E%20From%20Text/CSV%E2%80%9D%20wizard%20and%20manually%20selecting%20UTF-8%20encoding.%0A%0A%5B%5E1%5D%3A%20%5BCSV%20export%20encoding%20issues%20and%20Excel%20interpretation%5D%28https%3A//github.com/apache/superset/discussions/31463%23discussioncomment- 11577677%29%0A%5B%5E2%5D%3A%20%5BCSV%20export%20encoding%20and%20client-side%20factors%5D%28https%3A//github.com/apache/superset/discussions/31416%23discussioncomment-11541135%29%0A%5B%5E3%5D%3A%20%5BCSV_EXPORT%20config%20in%20Superset%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/config.py%23L19-L876%29%0A%5B%5E4%5D%3A%20%5BCsvResponse%20encoding%20logic%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/views/base.py%23L489-L495%29%0A%5B%5E5%5D%3A%20%5BChartDataRestApi%20CSV%20export%20encoding%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/charts/data/api.py%23L362-L389%29%0A%5B%5E6%5D%3A%20%5BCSV%20export%20command%20encoding%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/commands/sql_lab/export.py%23L104-L134%29%0A%5B%5E7%5D%3A%20%5BNo%20confirmed%20alternative%20fix%20for%20encoding% 20issues%5D%28https%3A//github.com/apache/superset/issues/20331%23issuecomment-2073665836%29) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/36374) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
