summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/library/tarfile.rst4
-rw-r--r--Lib/tarfile.py7
-rw-r--r--Misc/NEWS2
3 files changed, 8 insertions, 5 deletions
diff --git a/Doc/library/tarfile.rst b/Doc/library/tarfile.rst
index c2a9143..b1d7361 100644
--- a/Doc/library/tarfile.rst
+++ b/Doc/library/tarfile.rst
@@ -185,8 +185,8 @@ The following variables are available on module level:
.. data:: ENCODING
- The default character encoding i.e. the value from either
- :func:`sys.getfilesystemencoding` or :func:`sys.getdefaultencoding`.
+ The default character encoding: ``'utf-8'`` on Windows,
+ :func:`sys.getfilesystemencoding` otherwise.
.. seealso::
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index 31967dd..4839eb1 100644
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -159,9 +159,10 @@ TOEXEC = 0o001 # execute/search by other
#---------------------------------------------------------
# initialization
#---------------------------------------------------------
-ENCODING = sys.getfilesystemencoding()
-if ENCODING is None:
- ENCODING = "ascii"
+if os.name in ("nt", "ce"):
+ ENCODING = "utf-8"
+else:
+ ENCODING = sys.getfilesystemencoding()
#---------------------------------------------------------
# Some useful functions
diff --git a/Misc/NEWS b/Misc/NEWS
index 1335dbc..5a59310 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -421,6 +421,8 @@ C-API
Library
-------
+- Issue #8784: Set tarfile default encoding to 'utf-8' on Windows.
+
- Issue #8966: If a ctypes structure field is an array of c_char, convert its
value to bytes instead of str (as done for c_char and c_char_p).