decode

Decoding Gmail Body with Japanese Language using Python

Gist This is a sample script for decoding Gmail body with Japanese language using Python. msg = service.users().messages().get(userId='me', id=id).execute() parts = msg['payload']['parts'] for e in parts: msg = base64.urlsafe_b64decode(e['body']['data']).decode('utf-8').encode('cp932', "ignore").decode('cp932') print(msg)