python将windows-1252编码转中文时报错

我想将一串windows-1252编码的数据转化成中文时报错:

>>> str1 = '杨庆宣'
>>> a = str1.encode('windows-1252')
Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    a = str1.encode('windows-1252')
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\encodings\cp1252.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_table)
UnicodeEncodeError: 'charmap' codec can't encode character '\x9d' in position 1: character maps to <undefined>

这个错误我查了一下,发现在转化过程中,如果含有windows-1252 的0x81,0x8D,0x8F,0x90,0x9D时均会报以上错误。如果不含0x81,0x8D,0x8F,0x90,0x9D的windows-1252可以正常转化成中文:

>>> str = '指纹数'
>>> a = str.encode('windows-1252')
>>> a.decode()
'指纹数'
>>> 

请问一下,如果我需要转化含有0x81,0x8D,0x8F,0x90,0x9D的windows-1252成中文应该如何做?感激不尽

str1 = '杨庆宣'

a = str1.encode('cp1252', errors='ignore')
print(a.decode('utf-8', errors='ignore'))
# 庆宣

 

实际杨庆宣应该等于“杨庆宣”,忽略了0x9D之后就变成"庆宣"了...这个有办法解决吗