rename encode to reencode so it doesn't conflict with unicode.encode