str.encode(encoding, errors=‘strict’)
bytes.decode(encoding, errors=‘strict’)
open(filename, mode, encoding=None)
encoding
| The encoding to use, e.g. 'ascii'
, 'utf8'
, etc…errors
| The errors mode, e.g. 'replace'
to replace bad characters with question marks, 'ignore'
to ignore bad characters, etc…