Python doctest and Unicode

Today I found out about Python's doctest module. "The doctest module searches for pieces of text that look like interactive Python sessions, and then executes those sessions to verify that they work exactly as shown."

In the code I currently write I have a lot of docstrings I would like to constantly check, so that would help me a lot. Running it on my code though results in an UnicodeEncodeError:

  File "/usr/lib/python2.5/", line 1815, in testmod
  File "/usr/lib/python2.5/", line 1361, in run
    return self.__run(test, compileflags, out)
  File "/usr/lib/python2.5/", line 1215, in __run
    self.report_start(out, test, example)
  File "/usr/lib/python2.5/", line 1123, in report_start
    'Expecting:\n' + _indent(example.want))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 64: ordinal not in range(128)

It seems other people have the same problem: [1], [2].

After Python and Exceptions containing Unicode messages that is already the second Unicode problem in Python's core that I come across. Personal feeling: I do think that nowadays it isn't appropriate anymore for a serious programming language to have those problems.