#24500: Django runtests - 3 tests fail on windows due to encoding troubles -------------------------------------+------------------------------------- Reporter: pakal | Owner: nobody Type: Bug | Status: new Component: | Version: 1.7 Internationalization | Severity: Normal | Resolution: Keywords: | Triage Stage: | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by pakal): Weird, I updated to python 2.7.9 and tried with cmd.exe or git bash, still the same problem. I continued investigating, problems occur when django tries to lookup xgettext version. In gettext_popen_wrapper(), the output of django.core.management.utils.popen_wrapper is expected by django to be utf8 bytes, on python2 : {{{ if six.PY2: stdout = stdout.decode('utf-8') }}} However, from what I see in the initial popen_wrapper(), there are no reasons for stdout to be unicode on python2, only stderr gets converted, and Popen (AFAIK) outputs bytes (in cp1252 encoding, in that case). {{{ def popen_wrapper(args, os_err_exc_type=CommandError): """ Friendly wrapper around Popen. Returns stdout output, stderr output and OS status code. """ print "USING ENCODING >>>>>", DEFAULT_LOCALE_ENCODING # outputs "cp1252" try: p = Popen(args, shell=False, stdout=PIPE, stderr=PIPE, close_fds=os.name != 'nt', universal_newlines=True) except OSError as e: strerror = force_text(e.strerror, DEFAULT_LOCALE_ENCODING, strings_only=True) six.reraise(os_err_exc_type, os_err_exc_type('Error executing %s: %s' % (args[0], strerror)), sys.exc_info()[2]) output, errors = p.communicate() return ( output, force_text(errors, DEFAULT_LOCALE_ENCODING, strings_only=True), p.returncode ) }}} This is a mystery to me... could anybody check the intermediate values of this "xgettext -V" stdout, as well as the system encodings (locale.getdefaultlocale() and stuffs), on a machine which doesn't fail these tests ? -- Ticket URL: <https://code.djangoproject.com/ticket/24500#comment:3> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/063.a62c670cfee4adba0fab2638994f2b0c%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.