only encode string parameters to utf8

Is this for Python 3 compatibility?