]> granicus.if.org Git - python/commitdiff
Issue #8784: Set tarfile default encoding to 'utf-8' on Windows.
authorVictor Stinner <victor.stinner@haypocalc.com>
Fri, 11 Jun 2010 23:46:47 +0000 (23:46 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Fri, 11 Jun 2010 23:46:47 +0000 (23:46 +0000)
Note: file system encoding cannot be None anymore (since r81190, issue #8610).

Doc/library/tarfile.rst
Lib/tarfile.py
Misc/NEWS

index c2a9143702c8f5eb91b6c72af02a3637bba42cc6..b1d736130e7b49aebade4762ebfe647a26ee22d7 100644 (file)
@@ -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::
index 31967dd4d90c5048108bf87c5638e9c6d40d1a83..4839eb1aef1262786084315519e13adb59c135b1 100644 (file)
@@ -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
index 1335dbc0d1ba7da2bb281ddc2c768a008b522516..5a59310ebf18055b73e6bcf6ae106f49473f60e9 100644 (file)
--- 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).