0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

'shift_jis' codec can't encode character '\uff0d' in position 0: illegal multibyte sequence の解決

Posted at

結論から言うと"-"が原因なので"ー"に

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

原因となる文字列と置換後の文字列

>>> "-".encode("utf-8")
# Errorの原因
b'\xef\xbc\x8d'
>>> "ー".encode("utf-8")
b'\xe3\x83\xbc'

ややこしい

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?