This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author neves
Recipients neves
Date 2008-05-10.18:47:02
SpamBayes Score 0.010608388
Marked as misclassified No
Message-id <1210445230.87.0.512222933205.issue2811@psf.upfronthosting.co.za>
In-reply-to
Content
Doctest doesn't obey the specified file encoding for unicode literals.

I've put the minimum test case that demonstrate the error in the
attached file. 

The program has the # -*- coding: utf-8 -*- as the first line and is
saved in this encoding. My computer  environment is configured as
iso8859-1. Doctest ignores the file encoding specification and
interprets the u'á' as u'á' (the utf-8 text decoded as iso8859-1 )

I've reproduced this error in python 2.5 in linux and windows.


This is the output of the program below that runs the function normalize
from inside doctest and directly from python. They show different results.

**********************************************************************
File "doctesteerror.py", line 7, in __main__.normalize
Failed example:
    normalize(u'á')
Expected:
    u'b'
Got:
    u'\xc3\xa1'
**********************************************************************
1 items had failures:
   1 of   1 in __main__.normalize
***Test Failed*** 1 failures.
without doctest ===>>> b
History
Date User Action Args
2008-05-10 18:47:12nevessetspambayes_score: 0.0106084 -> 0.010608388
recipients: + neves
2008-05-10 18:47:10nevessetspambayes_score: 0.0106084 -> 0.0106084
messageid: <1210445230.87.0.512222933205.issue2811@psf.upfronthosting.co.za>
2008-05-10 18:47:09neveslinkissue2811 messages
2008-05-10 18:47:05nevescreate