Skip to content
Snippets Groups Projects
Commit 99eb38c6 authored by Sebastien Luttringer's avatar Sebastien Luttringer
Browse files

Fix issue with utf8 encoding in author

=> Image debian-generic v4 loaded
Error: 'ascii' codec can't encode character u'\xe9' in position 27: ordinal not in range(128)
Traceback (most recent call last):
  File "/usr/bin/is", line 482, in <module>
    error(e)
  File "/usr/bin/is", line 480, in <module>
    args.func(p_main, args)
  File "/usr/bin/is", line 242, in c_list
    img, repo = select_image(o, repoman, args.best)
  File "/usr/bin/is", line 64, in select_image
    return repoman.get(image, version, best)
  File "/usr/lib/python2.6/dist-packages/installsystems/repository.py", line 616, in get
    return repo.get(name, version), repo
  File "/usr/lib/python2.6/dist-packages/installsystems/repository.py", line 399, in get
    pkg = PackageImage(path, fileobj=memfile, md5name=True)
  File "/usr/lib/python2.6/dist-packages/installsystems/image.py", line 458, in __init__
    arrow("Author: %s" % self.author, 1)
  File "/usr/lib/python2.6/dist-packages/installsystems/printer.py", line 107, in arrow
    out(" #light##yellow#=>#reset# %s" % message)
  File "/usr/lib/python2.6/dist-packages/installsystems/printer.py", line 55, in out
    fd.write("%s%s" % (message, endl))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 27: ordinal not in range(128)
parent 40c52a40
No related branches found
No related tags found
No related merge requests found
......@@ -51,6 +51,10 @@ def out(message="", fd=sys.stdout, endl=os.linesep, flush=True):
message = message.replace("#%s#" % c, color[c])
else:
message = message.replace("#%s#" % c, "")
# convert unicode into str before write
# this can cause issue on python 2.6
if type(message) == unicode:
message = message.encode("utf8")
# printing
fd.write("%s%s" % (message, endl))
if flush:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment