[reportlab-users] Python files and ascii

Robin Becker robin at reportlab.com
Mon Feb 21 07:24:50 EST 2022


Claude,

I agree that Peter's suggestion is probably a good way forward. It would keep homoglyph stuff away from the isnatllation 
source.

Let's give it a few days in case others want to have a say. Perhaps there are experts who know what python is doing 
about it. I saw a lot about editors etc etc in the python-dev list discussion.

As it stands the existing test uses this for the search folder reportlab.lib.testutils.RL_HOME and that is None by 
default, but our tests use setOutDir which calculates it as


> 	import reportlab
> 	RL_HOME=reportlab.__path__[0]
> 	if not os.path.isabs(RL_HOME): RL_HOME=os.path.normpath(os.path.abspath(RL_HOME))

so currently I think the tests folder may be outside the test for ascii even if import reportlab resolves to

tests/../src/reportlab


As for this test; the initial code was checked in by Dinu Gherman in 2001;

https://hg.reportlab.com/hg-public/reportlab/rev/2eb7bc711395

the message wasn't very informative 'Initial checkin.'. It might just have been a method for him to prevent usage of 
umlauts, which might well have caused problems in those days. Certainly python was not using unicode at that time.


On 21/02/2022 11:27, Claude Paroz wrote:
> Hi Robin, Peter,
> 
> Thanks for the threatpost link. Indeed a good think to be aware of. I'ts just a bit sad that once again, hackers are 
> winning in a sense :-(
> 
> 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'))
> 
> Claude
> 
> Le 21.02.22 à 12:02, Peter Cock a écrit :
>> That's a good point Robin, something I'll keep in mind for other Python projects.
>> Generally it has only been people's names where I/we have needed this (things
>> like contributor listings or references in comments/docstrings).
>>
>> Would it be a helpful compromise to allow unicode Python files for the tests only?
>>
>> Peter
>>
>> On Mon, Feb 21, 2022 at 10:51 AM Robin Becker <robin at reportlab.com <mailto:robin at reportlab.com>> wrote:
>>
>>     Hi Claude,
>>
>>     I am a bit unsure about this patch. I accept the unique test is
..........
>>
>>     What do others think?
>>
........

-- 
Robin Becker


More information about the reportlab-users mailing list