[PYTHON] 'shift_jis' codec can't encode character'\ uff0d' in position 0: resolution of illegal multibyte sequence

From the conclusion, "-" is the cause, so "-"

somestring.replace("-", "-")

Cause string and replaced string

>>> "-".encode("utf-8")
#Cause of Error
b'\xef\xbc\x8d'
>>> "-".encode("utf-8")
b'\xe3\x83\xbc'

Complicated

Recommended Posts

'shift_jis' codec can't encode character'\ uff0d' in position 0: resolution of illegal multibyte sequence
I was addicted to deploying GoogleCloudFunctions ('ascii' codec can't encode character u'\ u281b' in position 58 appears)
Store Japanese (multibyte character string) in sqlite3 of python
'Ascii' codec can't encode characters in position xx-xx: ordinal not in range (128) when calling PHP → Python