238
238
output_encoding = getattr(sys.stdout, 'encoding', None)
239
239
if not output_encoding:
240
output_encoding = bzrlib.user_encoding
241
mutter('encoding stdout bzrlib.user_encoding %r', output_encoding)
240
input_encoding = getattr(sys.stdin, 'encoding', None)
241
if not input_encoding:
242
output_encoding = bzrlib.user_encoding
243
mutter('encoding stdout as bzrlib.user_encoding %r', output_encoding)
245
output_encoding = input_encoding
246
mutter('encoding stdout as sys.stdin encoding %r', output_encoding)
243
mutter('encoding stdout log as sys.stdout encoding %r', output_encoding)
248
mutter('encoding stdout as sys.stdout encoding %r', output_encoding)
245
250
# use 'replace' so that we don't abort if trying to write out
246
251
# in e.g. the default C locale.
247
252
self.outf = codecs.getwriter(output_encoding)(sys.stdout, errors=self.encoding_type)
253
# For whatever reason codecs.getwriter() does not advertise its encoding
254
# it just returns the encoding of the wrapped file, which is completely
255
# bogus. So set the attribute, so we can find the correct encoding later.
256
self.outf.encoding = output_encoding
249
258
@deprecated_method(zero_eight)
250
259
def run_argv(self, argv):