From 867a2cfb8e4d478d89e419b485a77fbbf2f0460e Mon Sep 17 00:00:00 2001 From: Hongchang Liu Date: Mon, 20 May 2019 17:28:51 +0800 Subject: [PATCH] Only UTF-8 encoding is supported on VxWorks --- Doc/library/locale.rst | 2 ++ Lib/test/test_c_locale_coercion.py | 4 ++++ .../next/Library/2019-05-20-10-20-02.bpo-31904.a845cm.rst | 1 + 3 files changed, 7 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2019-05-20-10-20-02.bpo-31904.a845cm.rst diff --git a/Doc/library/locale.rst b/Doc/library/locale.rst index bf57a083559168..9e53f8a0a47614 100644 --- a/Doc/library/locale.rst +++ b/Doc/library/locale.rst @@ -331,6 +331,8 @@ The :mod:`locale` module defines the following exception and functions: The function now always returns ``UTF-8`` on Android or if the UTF-8 mode is enabled. + On VxWorks, always return ``'UTF-8'``, the locale and the *do_setlocale* + argument are ignored. .. function:: normalize(localename) diff --git a/Lib/test/test_c_locale_coercion.py b/Lib/test/test_c_locale_coercion.py index 35272b5c15aca7..51893d7820fc58 100644 --- a/Lib/test/test_c_locale_coercion.py +++ b/Lib/test/test_c_locale_coercion.py @@ -52,6 +52,10 @@ # TODO: Work out a robust dynamic test for this that doesn't rely on # CPython's own locale handling machinery EXPECT_COERCION_IN_DEFAULT_LOCALE = False +elif sys.platform == "vxworks": + # VxWorks defaults to using UTF-8 for all system interfaces + EXPECTED_C_LOCALE_STREAM_ENCODING = "utf-8" + EXPECTED_C_LOCALE_FS_ENCODING = "utf-8" # Note that the above expectations are still wrong in some cases, such as: # * Windows when PYTHONLEGACYWINDOWSFSENCODING is set diff --git a/Misc/NEWS.d/next/Library/2019-05-20-10-20-02.bpo-31904.a845cm.rst b/Misc/NEWS.d/next/Library/2019-05-20-10-20-02.bpo-31904.a845cm.rst new file mode 100644 index 00000000000000..f57df97615b5ed --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-05-20-10-20-02.bpo-31904.a845cm.rst @@ -0,0 +1 @@ +Port test_c_locale_coercion to VxWorks: only UTF-8 encoding is supported on VxWorks