code: def get_encodings(hint_encoding='utf-8'):
      
      fallbacks = {
          'latin1': 'latin9',
          'iso-8859-1': 'iso8859-15',
          'cp1252': '1252',
      }
      if hint_encoding:
          yield hint_encoding
          if hint_encoding.lower() in fallbacks:
              yield fallbacks[hint_encoding.lower()]
  
      # some defaults (also taking care of pure ASCII)
      for charset in ['utf8', 'latin1', 'ascii']:
          if not hint_encoding or (charset.lower() != hint_encoding.lower()):
              yield charset
  
      from locale import getpreferredencoding
      prefenc = getpreferredencoding()
      if prefenc and prefenc.lower() != 'utf-8':
          yield prefenc
          prefenc = fallbacks.get(prefenc.lower())
          if prefenc:
              yield prefenc
docs: Used to try different encoding.
      Function copied from Odoo 11.0 (odoo.loglevels.get_encodings).
      This piece of code is licensed under the LGPL-v3 and so it is compatible
      with the LGPL-v3 license of OdooRPC::
  
          - https://github.com/odoo/odoo/blob/11.0/LICENSE
          - https://github.com/odoo/odoo/blob/11.0/COPYRIGHT