hi, cat test.py #!/usr/bin/env python #-*- coding: utf-8 -*- u = u'moçambique' print u.encode("utf-8") print u
chmod +x test.py ./test.py moçambique moçambique ./test.py > output.txt Traceback (most recent call last): File "./test.py", line 5, in <module> print u UnicodeEncodeError: 'ascii' codec can't encode character u'\xe7' in position 2: ordinal not in range(128) in python 2.7 how I explain to python to send the same thing to stdout and the file output.txt ? Don't seems logic, when send things to a file the beaviour change. Thanks, Sérgio M. B. -- http://mail.python.org/mailman/listinfo/python-list