mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #26919: On Android, operating system data is now always encoded/decoded
to/from UTF-8, instead of the locale encoding to avoid inconsistencies with os.fsencode() and os.fsdecode() which are already using UTF-8.
This commit is contained in:
parent
3d3f264849
commit
76febd0792
4 changed files with 17 additions and 12 deletions
|
@ -8,7 +8,7 @@ import shutil
|
|||
import sys
|
||||
import subprocess
|
||||
import tempfile
|
||||
from test.support import script_helper
|
||||
from test.support import script_helper, is_android
|
||||
from test.support.script_helper import (spawn_python, kill_python, assert_python_ok,
|
||||
assert_python_failure)
|
||||
|
||||
|
@ -178,15 +178,16 @@ class CmdLineTest(unittest.TestCase):
|
|||
if not stdout.startswith(pattern):
|
||||
raise AssertionError("%a doesn't start with %a" % (stdout, pattern))
|
||||
|
||||
@unittest.skipUnless(sys.platform == 'darwin', 'test specific to Mac OS X')
|
||||
def test_osx_utf8(self):
|
||||
@unittest.skipUnless((sys.platform == 'darwin' or
|
||||
is_android), 'test specific to Mac OS X and Android')
|
||||
def test_osx_android_utf8(self):
|
||||
def check_output(text):
|
||||
decoded = text.decode('utf-8', 'surrogateescape')
|
||||
expected = ascii(decoded).encode('ascii') + b'\n'
|
||||
|
||||
env = os.environ.copy()
|
||||
# C locale gives ASCII locale encoding, but Python uses UTF-8
|
||||
# to parse the command line arguments on Mac OS X
|
||||
# to parse the command line arguments on Mac OS X and Android.
|
||||
env['LC_ALL'] = 'C'
|
||||
|
||||
p = subprocess.Popen(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue