I used Python2.7 to do this but I always got the same error when I try to insert the '€' symbol in my code. My OS system is windows 10.
When I run this code:
dic = {
'\\' : b'\xe2\x95\x9a',
'-' : b'\xe2\x95\x90',
'/' : b'\xe2\x95\x9d',
'|' : b'\xe2\x95\x91',
'+' : b'\xe2\x95\x94',
'%' : b'\xe2\x95\x97',
'$' : b'\xe2\x82\xac',
}
def decode(x):
return (''.join(dic.get(i, i.encode('utf-8')).decode('utf-8') for i in x))
print(decode('+------------------------------------%'))
print(decode('| |'))
print(decode('| |'))
print(decode('\\------------------------------------/'))
I got this:
╔════════════════════════════════════╗
║ ║
║ ║
╚════════════════════════════════════╝
but when I add the $ symbol I got:
╔════════════════════════════════════╗
║ ║
Traceback (most recent call last):
File "test.py", line 14, in <module>
print(decode('| $ |'))
File "C:\Python27\lib\encodings\cp850.py", line 12, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\u20ac' in position 17: character maps to <undefined>
What I did wrong?