Python : UnicodeEncodeError: 'latin-1' codec can't encode character

后端 未结 3 1273
别跟我提以往
别跟我提以往 2021-01-04 05:34

I am at a scenario where I call api and based on the results from api I call database for each record that I in api. My api call return strings and when I make the database

3条回答
  •  借酒劲吻你
    2021-01-04 06:11

    The unicode character u'\02013' is the "en dash". It is contained in the Windows-1252 (cp1252) character set (with the encoding x96), but not in the Latin-1 (iso-8859-1) character set. The Windows-1252 character set has some more characters defined in the area x80 - x9f, among them the en dash.

    The solution would be for you to choose a different target character set than Latin-1, such as Windows-1252 or UTF-8, or to replace the en dash with a simple "-".

提交回复
热议问题