Added unicode test and fixed decoding and error messages