[reportlab-users] Python files and ascii

cito at online.de cito at online.de
Mon Feb 21 07:28:11 EST 2022


On 21.02.2022 12:27, Claude Paroz wrote:
 > I like the proposal of Peter, alowing unicode for test files. Because
 > Unicode is rather useful in tests. Typically, it's just more friendly to
 > write:
 >
 > para = Paragraph("Viele Grüße")
 >
 > than
 >
 > para = Paragraph(b'Viele Gr\xc3\xbc\xc3\x9fe'.decode('utf-8'))

Btw, that has been possible since Python 2.3 with a "# coding = " magic 
comment. What's new is that Python 3 assumes UTF-8 by default instead of 
ASCII and that you can use Unicode even in variable names.

-- Christoph


More information about the reportlab-users mailing list