2 ms·
Actually, I think I'm wrong about python's behavior, at least now; it doesn't omit the files, and instead does something with surrogates. On Linux: >>> b'
by jefftk 4y ago
Actually, I think I'm wrong about python's behavior, at least now; it doesn't omit the files, and instead does something with surrogates. On Linux:
>>> b'\xc0'.decode('utf-8')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 0: invalid start byte
>>> open(b'\xc0', 'w').write('foo')
3
>>> os.listdir()
['\udcc0']
>>> open(b'\xc0').read()
'foo'
>>> open('\udcc0').read()
'foo'
- naniwaduni 4y agoPEP 383[1] is a workaround, but it took a while to get there[2]. [1]: https://peps.python.org/pep-0383/ https://peps.python.org/pep-0383/ [2]: cf. https://github.com/bup/bup/blob/master/DESIGN#L667-L729 https://github.com/bup/bup/blob/master/DESIGN#L667-L729