285
285
return shutil.rmtree(path, ignore_errors, onerror)
288
def get_terminal_encoding():
289
"""Find the best encoding for printing to the screen.
291
This attempts to check both sys.stdout and sys.stdin to see
292
what encoding they are in, and if that fails it falls back to
293
bzrlib.user_encoding.
294
The problem is that on Windows, locale.getpreferredencoding()
295
is not the same encoding as that used by the console:
296
http://mail.python.org/pipermail/python-list/2003-May/162357.html
298
On my standard US Windows XP, the preferred encoding is
299
cp1252, but the console is cp437
301
output_encoding = getattr(sys.stdout, 'encoding', None)
302
if not output_encoding:
303
input_encoding = getattr(sys.stdin, 'encoding', None)
304
if not input_encoding:
305
output_encoding = bzrlib.user_encoding
306
mutter('encoding stdout as bzrlib.user_encoding %r', output_encoding)
308
output_encoding = input_encoding
309
mutter('encoding stdout as sys.stdin encoding %r', output_encoding)
311
mutter('encoding stdout as sys.stdout encoding %r', output_encoding)
312
return output_encoding
288
315
def normalizepath(f):
289
316
if hasattr(os.path, 'realpath'):