XLSX generation: Remove invalid unicode characters

This commit is contained in:
Raphael Michel
2022-12-09 17:41:33 +01:00
parent 979d23e997
commit 247a61489f
2 changed files with 10 additions and 3 deletions

View File

@@ -24,11 +24,13 @@ from openpyxl.cell.cell import TYPE_STRING
from pretix.helpers.safe_openpyxl import SafeWorkbook
def test_nullbyte_removed():
def test_invalid_byte_removed():
wb = SafeWorkbook()
ws = wb.create_sheet()
ws.append(["foo\u0000bar"])
assert ws.cell(1, 1).value == "foobar"
ws.append(["foo\uffffbaz"])
assert ws.cell(2, 1).value == "foobaz"
def test_no_formulas():