Jul-02-2020, 09:09 PM
(This post was last modified: Jul-02-2020, 09:09 PM by Gribouillis.)
If you encode an ascii string with the UTF-8 encoding, it does not change a single byte. For non ascii characters there are more bytes.
>>> "Hello InfinityQuest!".encode('utf-8') b'Hello InfinityQuest!' >>> "hétérogénéité".encode('utf-8') b'h\xc3\xa9t\xc3\xa9rog\xc3\xa9n\xc3\xa9it\xc3\xa9'Your way to write binary files is perfect.