#!/usr/bin/env python """ Python2 snippet for taking a base64-encoded unicode string, decoding it properly so there aren't trailing null bytes for ASCII characters Leaving this here so I don't have to look it up again @decidedlygray """ import base64 b64_str = "ADD BASE64 UNICODE STRING HERE" b64_str_decoded = base64.b64decode(b64_str).decode('UTF-16')