'ascii' codec can't encode character u'\xe0'

Hi,

I use Windows 8.1, x64, Turkish. I make clean install but Ace engine does not start.

acestream.log content:

2013-12-31 19:53:43,994|acestream|enable debug: 0
2013-12-31 19:53:43,996|acestream|version=2.1.10.1 revision=432 date=2013/11/07 14:18:38
2013-12-31 19:53:43,996|acestream|get_default_api_version: 2
2013-12-31 19:53:44,384|acestream.coreapp|cannot load session config, use default
2013-12-31 19:53:45,194|acestream.SocketHandler.InterruptSocket|bound on 127.0.0.1:60886
2013-12-31 19:53:45,194|acestream.LM|listen on 8621
2013-12-31 19:53:45,194|acestream.localdb|No existing database found. Attempting to creating a new database u’C:\Users\Antin\AppData\Roaming\.ACEStream\sqlite\torrentstream.sdb’
2013-12-31 19:53:45,334|acestream.coreapp|init: set default user credentials on the first run
2013-12-31 19:53:45,335|acestream|error during startup
Traceback (most recent call last):
File “core.c”, line 523, in
File “core.c”, line 132, in
File “core.c”, line 120, in
File “core.c”, line 381, in
UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\xe0’ in position 136: ordinal not in range(128)
2013-12-31 19:53:50,931|acestream|enable debug: 0
2013-12-31 19:53:50,931|acestream|version=2.1.10.1 revision=432 date=2013/11/07 14:18:38
2013-12-31 19:53:50,933|acestream|get_default_api_version: 2
2013-12-31 19:53:51,700|acestream.coreapp|cannot load session config, use default
2013-12-31 19:53:51,815|acestream.SocketHandler.InterruptSocket|bound on 127.0.0.1:52423
2013-12-31 19:53:51,815|acestream.LM|listen on 8621
2013-12-31 19:53:51,825|acestream|error during startup
Traceback (most recent call last):
File “core.c”, line 523, in
File “core.c”, line 132, in
File “core.c”, line 120, in
File “core.c”, line 381, in
UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\xe0’ in position 136: ordinal not in range(128)

I couldn’t find a solution, please help me.

Try setting the system default encoding as utf-8 at the start of the script, so that all strings are encoded using that.

Example -

import sys
reload(sys)
sys.setdefaultencoding('utf-8')

The above should set the default encoding as utf-8 .

In most cases, the issue is that when you call str(), python uses the default character encoding to try and encode the bytes you gave it, which in your case are sometimes representations of unicode characters. To fix the problem, you have to tell python how to deal with the string you give it by using .encode(‘whatever_unicode’). Most of the time, you should be fine using utf-8. So, stop using str() to convert from unicode to encoded text / bytes, properly use .encode() to encode the string:,

yourstring.encode('utf-8')

For python 3.x ,there is default encoding, hence there will be no issue of encoding.