diff options
author | Gerald Combs <gerald@wireshark.org> | 2018-11-26 10:01:42 -0800 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-11-27 04:40:47 +0000 |
commit | 164a9920e74c8cce150704d8bfcb2a7e4d47956d (patch) | |
tree | 93a57c7b586853887d69b5d02f27d71247daa11a /test | |
parent | d8ac73ce30625f02e205fde80a603c200882bf53 (diff) |
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>
Diffstat (limited to 'test')
-rwxr-xr-x | test/test.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test/test.py b/test/test.py index f775bae85c..c64891bb1c 100755 --- a/test/test.py +++ b/test/test.py @@ -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') |