Replaced unicode() by str.decode('utf-8') to avoid ascii decoding errors