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?
this is really strange. Maybe its not a "textfield" issue, but a Pythonista behaviour?
barcode = input("Barcode = ") print(barcode.encode('utf-8'))
When scanning into input prompt:
Output python 3.6 on macOS:
Barcode = 12345^[[19~6789
Output Pythonista 3 on ios
Barcode = 123456789
Why is Pythonista suppressing the escape-sequences???
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)
in pythonista ui I use a textfield to obtain the input of an barcode scanner:
class TextFieldDelegate(object): def textfield_did_end_editing(self, textfield): barcode = textfield.text return True
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.
barcode = textfield.text.encode() provides b'123456789'
Any ideas? Thank you!