django-commons / drf-excel

An XLSX spreadsheet renderer for Django REST Framework.
BSD 3-Clause "New" or "Revised" License
217 stars 40 forks source link

Update json.dumps arg in XLSXListField for Unicode characters #64

Closed suhanoves closed 2 years ago

suhanoves commented 2 years ago

For languages with Unicode characters, ignoring ensure_ascii results in the Excel output of rows like

{
  "Заголовок": "пример",
}

in the wrong format:

{
  "\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a": "\u043f\u0440\u0438\u043c\u0435\u0440",
}

From documentation:

If ensure_ascii is true (the default), the output is guaranteed to have all incoming non-ASCII characters escaped. If ensure_ascii is false, these characters will be output as-is.

FlipperPA commented 2 years ago

Thank you! This has been published to PyPI at 2.2.0:

https://github.com/wharton/drf-excel/releases/tag/2.2.0

https://pypi.org/project/drf-excel/2.2.0/