I'm Using python 3.5
I have a couple of byte strings representing text that is encoded in various codecs so: b'mybytesstring'
, now some are Utf8
encoded other are latin1
and so on. What I want to in the following order is:
The problem is that I have to move the bytes string into something that does not accept bytes objects so I'm looking for a solution that lets me do bytes -> ascii -> bytes
safely.
x = x.decode().encode('ascii',errors='ignore')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With