This works very well for barcodes without escape-sequences. But in my usecase the scanner sends a "\x1b[19~" as delimeter between data-fields.
The ui textfield apparently ignors the escape-sequences. For example:

Barcode is "12345\x1b[19~6789"
textfield.text provides "12345678989". I need the delimeter to set apart the data-fields in the barcode.

thank you for your quick answer, but this does not help, because the textfield.text does NOT deliver the escape-code, it seems to be filtered in the ui textfield-routine(?)
(the barcode scanner works as a external keyboard an sends the scanned data direct in the textfield)

oh, are you using a physical barcode scanner?
you might need to use a textfield_should_change delegate, which i think gives you the replacement text. once it goes into the textfield, no printables are stripped, i think.

I did some further research... obviously the non printable escape sequences are filtert by ios keyboard driver.
When I scan directly into an Raspberry-Shell the escape sequences are displayed but when I opened a shell via ios (for example "shelly") non printable characters are filtert.
So its not a problem of pythonista! Should I delete the threat?