Fixed python version incompatibility

see http://grokbase.com/t/python/python-bugs-list/116jyqycww/issue3067-setlocale-fails-with-unicode-strings-on-py2-and-with-byte-strings-on-py3