functions to get us out of encoding hell