PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import sys
import codecs
# I'm switching encodings from CP1252 (Windows Latin-1) to CP850 (DOS Latin-1)
# Question; https://www.sololearn.com/Discuss/174545/?ref=app
# Notice how it prints out of order...
print("1. £3")
print("2. StdOut: " + sys.stdout.encoding + " / StdErr: " + sys.stderr.encoding)
if sys.stdout.encoding != 'cp850':
sys.stdout = codecs.getwriter('cp850')(sys.stdout.buffer, 'strict')
if sys.stderr.encoding != 'cp850':
sys.stderr = codecs.getwriter('cp850')(sys.stderr.buffer, 'strict')
# Encoding attributr is gone now...
# print("2. StdOut: " + sys.stdout.encoding + " / StdErr: " + sys.stderr.encoding)
print("3. £3")
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run