Lines Matching +full:utf +full:- +full:8
2 Test the implementation of the PEP 540: the UTF-8 Mode.
46 out = self.get_output('-c', code, LC_ALL=loc)
52 out = self.get_output('-X', 'utf8', '-c', code)
55 # undocumented but accepted syntax: -X utf8=1
56 out = self.get_output('-X', 'utf8=1', '-c', code)
59 out = self.get_output('-X', 'utf8=0', '-c', code)
63 # PYTHONLEGACYWINDOWSFSENCODING disables the UTF-8 Mode
64 # and has the priority over -X utf8
65 out = self.get_output('-X', 'utf8', '-c', code,
72 out = self.get_output('-c', code, PYTHONUTF8='1')
75 out = self.get_output('-c', code, PYTHONUTF8='0')
78 # -X utf8 has the priority over PYTHONUTF8
79 out = self.get_output('-X', 'utf8=0', '-c', code, PYTHONUTF8='1')
83 # PYTHONLEGACYWINDOWSFSENCODING disables the UTF-8 mode
85 out = self.get_output('-X', 'utf8', '-c', code, PYTHONUTF8='1',
90 # the UTF-8 mode
92 # PYTHONUTF8 should be ignored if -E is used
93 out = self.get_output('-E', '-c', code, PYTHONUTF8='1')
97 out = self.get_output('-c', code, PYTHONUTF8='xxx', failure=True)
109 expected = 'utf-8/surrogatepass'
111 expected = 'utf-8/surrogateescape'
113 out = self.get_output('-X', 'utf8', '-c', code)
117 # PYTHONLEGACYWINDOWSFSENCODING disables the UTF-8 mode
118 # and has the priority over -X utf8 and PYTHONUTF8
119 out = self.get_output('-X', 'utf8', '-c', code,
132 out = self.get_output('-X', 'utf8', '-c', code,
135 ['stdin: utf-8/surrogateescape',
136 'stdout: utf-8/surrogateescape',
137 'stderr: utf-8/backslashreplace'])
140 out = self.get_output('-X', 'utf8', '-c', code,
143 ['stdin: iso8859-1/strict',
144 'stdout: iso8859-1/strict',
145 'stderr: iso8859-1/backslashreplace'])
147 out = self.get_output('-X', 'utf8', '-c', code,
150 ['stdin: utf-8/namereplace',
151 'stdout: utf-8/namereplace',
152 'stderr: utf-8/backslashreplace'])
163 out = self.get_output('-c', code, filename, PYTHONUTF8='1')
164 self.assertEqual(out.lower(), 'utf-8/strict')
182 out = self.get_output('-c', code, filename,
186 encoding = 'utf-8'
205 out = self.get_output('-X', 'utf8', '-c', code)
206 self.assertEqual(out, 'utf-8 utf-8')
210 out = self.get_output('-X', 'utf8', '-c', code, LC_ALL=loc)
211 self.assertEqual(out, 'utf-8 utf-8')
215 arg = 'h\xe9\u20ac'.encode('utf-8')
216 arg_utf8 = arg.decode('utf-8')
221 out = self.get_output('-X', utf8_opt, '-c', code, arg, **kw)
233 c_arg = arg.decode('iso-8859-1')
242 # twice when -X utf8 requires to parse the configuration twice (when
246 out = self.get_output('-X', 'utf8', '-O', '-c', code)
248 out = self.get_output('-X', 'utf8', '-OO', '-c', code)
252 out = self.get_output('-X', 'utf8', '-E', '-c', code)
257 "the UTF-8 Mode on Windows")
268 f'out = open({filename!r}, "w", encoding="utf-8"); '
271 cmd = [sys.executable, '-X', 'utf8', '-c', code]
276 # In UTF-8 Mode, device_encoding(fd) returns "UTF-8" if fd is a TTY
279 self.assertEqual(out, 'True utf-8')