need help understanding: converting text to binary

Gregory Ewing greg.ewing at canterbury.ac.nz
Tue Apr 23 18:50:10 EDT 2019


Cameron Simpson wrote:
> If you don't know the encoding then you don't know you're looking at a 
> hex digit. OTOH, if the binary data contain ASCII data then you do know 
> the encoding: it is ASCII.

Not necessarily, it could be a superset of ASCII such as latin-1 or
utf-8.

You do need to know that it is such an encoding, however. If the
encoding is completely unknown, you can't make any assumptions.

-- 
Greg



More information about the Python-list mailing list