def fix_win_console(encoding):
 if (isinstance(sys.stdout, WinUnicodeOutputBase) or isinstance(sys.stderr, WinUnicodeOutputBase)):
  return False
 try:
  sys.stdout = win_get_unicode_stream(sys.stdout, 1, (-11), encoding)
  sys.stderr = win_get_unicode_stream(sys.stderr, 2, (-12), encoding)
 except Exception as e:
  complain(('exception %r while fixing up sys.stdout and sys.stderr' % e))
 return True

def fix_win_console ( encoding ) : if ( isinstance ( sys . stdout , WinUnicodeOutputBase ) or isinstance ( sys . stderr , WinUnicodeOutputBase ) ) : return False try : sys . stdout = win_get_unicode_stream ( sys . stdout , 1 , ( - 11 ) , encoding ) sys . stderr = win_get_unicode_stream ( sys . stderr , 2 , ( - 12 ) , encoding ) except Exception as e : complain ( ( 'exception %r while fixing up sys.stdout and sys.stderr' % e ) ) return True
makes unicode console output work independently of the current code page .