我正在尝试将图像上传到网页,该网页在上传时会被编码。
编辑:编码应为ISO 8859-9,但如何编码 图片?
我已经这样尝试过了:
with open(r'C:/Users/Oli/Google Drive/IMG_20190616_153823.jpg', "rb") as fh:
a = fh.read()
print(a.decode('iso-8859-1'))
获取返回的错误:
Traceback (most recent call last):
File "C:/Users/Oli/Downloads/IF/test.py", line 5, in <module>
print(a.decode('iso-8859-1'))
File "C:\Users\Oli\AppData\Local\Programs\Python\Python37-32\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 '\x89' in position 0: character maps to <undefined>