﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
26673	i18n tests: Unicode in enviroment vars isn't accepted on Python2+Windows	Ramiro Morales	Ramiro Morales	"Starting with 5005b527 and eda306f1 we are adding u`LANG=C` to the enviroment on which a test case (`i18n.test_compilation.CompilationErrorHandling.test_msgfmt_error_including_non_ascii`) is run.

On Windows + Python 2.7 this is causing the following error:

{{{
======================================================================                                                     
ERROR: test_msgfmt_error_including_non_ascii (i18n.test_compilation.CompilationErrorHandling)                              
----------------------------------------------------------------------                                                     
Traceback (most recent call last):
  File ""C:\django\upstream\tests\i18n\test_compilation.py"", line 179, in test_msgfmt_error_including_non_ascii
    call_command('compilemessages', locale=['ko'], verbosity=0)
  File ""C:\django\upstream\django\core\management\__init__.py"", line 130, in call_command
    return command.execute(*args, **defaults)
  File ""C:\django\upstream\django\core\management\base.py"", line 356, in execute
    output = self.handle(*args, **options)
  File ""C:\django\upstream\django\core\management\commands\compilemessages.py"", line 103, in handle
    self.compile_messages(locations)
  File ""C:\django\upstream\django\core\management\commands\compilemessages.py"", line 128, in compile_messages 
    output, errors, status = popen_wrapper(args)
  File ""C:\django\upstream\django\core\management\utils.py"", line 21, in popen_wrapper
    p = Popen(args, shell=False, stdout=PIPE, stderr=PIPE, close_fds=os.name != 'nt')
  File ""C:\django\upstream\tests\i18n\test_compilation.py"", line 175, in <lambda>
    with mock.patch('django.core.management.utils.Popen', lambda *args, **kwargs: Popen(*args, env=env, **kwargs)):
  File ""C:\py27-64\Lib\subprocess.py"", line 710, in __init__
    errread, errwrite)
  File ""C:\py27-64\Lib\subprocess.py"", line 958, in execute_child
    startupinfo)
TypeError: environment can only contain strings                                                
}}}

This is caused by the fact that this Python version+OS combination needs bytestrings as env var value and name (at least Python 2.7 on Linux doesn't seem to be as picky).

This is related to our usage of `from __future__ import unicode_literals` on that module.

Other projects faced similar problems:

* https://github.com/jupyter/nbconvert/pull/165
* https://github.com/nvie/pip-tools/issues/209"	Bug	closed	Internationalization	dev	Normal	fixed	windows i18n		Ready for checkin	1	0	0	0	0	0
