TokenMarketNet/smart-contracts

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 994: ordinal not in range(128)

nobody93 opened this issue · 4 comments

Running ico on Debian 9 platoform under installation instructions, but running py.test ico resulted following errors
test2.log
, please see attached log file for more details

def decode(self, input, final=False):
  return codecs.ascii_decode(input, self.errors)[0]

E UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 994: ordinal not in range(128)

Interesting. @ztane How did you enforce Linux (Debian) locale to be UTF-8 before running a command?

ztane commented

Yeah, the problem is the definition of build_standard_input_sources:

@to_dict
def build_standard_input_sources(source_file_paths):
    for file_path in source_file_paths:
        with open(file_path) as source_file:
            yield file_path, {'content': source_file.read()}

The open without explicit encoding defaults to the locale encoding. If your locale is not set correctly, Python 3.6 and below will default to ASCII. Python 3.7+ will default to using UTF-8 in any case.

You need to set a UTF-8 locale, any locale with UTF-8 charsets should do. Nowadays Linux should come with C.UTF-8 locale so that should do: export LC_ALL=C.UTF-8, and check the output of locale.

In any case, this is a bug in Populus (it should not depend on the locale setting at all), not the ico package
itself.

I have changed the Debian locale default setup, it can now support the utf-8, that error has gone, but I've got another error of E KeyError: 'linkrefs', the details in attached log file. Thank you.
test.log

I believe that issue has been resolved after I downgrade solc to version 0.4.18, although there are many warnings, please have a look at attached test log file and to confirm.
test1.log