forked from osmocom/wireshark
Test: Look up our encoding name before checking it.
Resolve our output encoding name to something that's hopefully the same on all platforms so that we don't print Warning: Output encoding is utf-8 and not UTF-8. on Windows. Change-Id: I9c7703eac6e12f5a95f701e8a9bea7d17a513fef Reviewed-on: https://code.wireshark.org/review/30795 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
d8ac73ce30
commit
164a9920e7
|
@ -16,6 +16,7 @@
|
|||
|
||||
|
||||
import argparse
|
||||
import codecs
|
||||
import os.path
|
||||
import sys
|
||||
import unittest
|
||||
|
@ -121,10 +122,9 @@ def main():
|
|||
print('\n'.join(list(cases)))
|
||||
sys.exit(0)
|
||||
|
||||
if sys.stdout.encoding != 'UTF-8':
|
||||
import codecs
|
||||
if codecs.lookup(sys.stdout.encoding).name != 'utf-8':
|
||||
import locale
|
||||
sys.stderr.write('Warning: Output encoding is {0} and not UTF-8.\n'.format(sys.stdout.encoding))
|
||||
sys.stderr.write('Warning: Output encoding is {0} and not utf-8.\n'.format(sys.stdout.encoding))
|
||||
sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout.buffer, 'backslashreplace')
|
||||
sys.stderr = codecs.getwriter(locale.getpreferredencoding())(sys.stderr.buffer, 'backslashreplace')
|
||||
|
||||
|
|
Loading…
Reference in New Issue