avoid UnicodeEncodeError when params contains non ascii characters