$ python -c "print('└')"
└
$ python -c "print('└')" > test_file.txt
Traceback (most recent call last):
On 13 Nov 2022, at 14:52, Jessica Smith <12jessicasmith34@gmail.com> wrote:
Consider the following code ran in Powershell or cmd.exe:
$ python -c "print('└')"
└
$ python -c "print('└')" > test_file.txt
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\Python38\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u2514' in position 0: character maps to <undefined>
Is this a known limitation of Windows + Unicode? I understand that
using -x utf8 would fix this, or modifying various environment
variables. But is this expected for a standard Python installation on Windows?
Jessica
--
https://mail.python.org/mailman/listinfo/python-list
Consider the following code ran in Powershell or cmd.exe:
$ python -c "print('└')"
└
$ python -c "print('└')" > test_file.txt
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\Python38\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u2514' in position 0: character maps to <undefined>
Is this a known limitation of Windows + Unicode? I understand that
using -x utf8 would fix this, or modifying various environment
variables. But is this expected for a standard Python installation on Windows?
Jessica
|C:\Users\s>py -c "import locale, sys; print( locale.getpreferredencoding( False ), file=sys.stderr )" >test_file.txt
|cp1252
Consider the following code ran in Powershell or cmd.exe:
$ python -c "print('└')"
└
$ python -c "print('└')" > test_file.txt
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\Python38\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u2514' in position 0: character maps to <undefined>
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (2 / 14) |
Uptime: | 01:58:42 |
Calls: | 10,385 |
Calls today: | 2 |
Files: | 14,057 |
Messages: | 6,416,581 |