remove unecessary encoding statement and create workaround for Python 3