esi / esi-issues

Issue tracking and feature requests for ESI
https://esi.evetech.net/
209 stars 23 forks source link

/characters/{character_id}/ sometimes returns description string in Python format #1265

Open ErikKalkoken opened 3 years ago

ErikKalkoken commented 3 years ago

Bug

When requesting the characters information for certain characters, the string returned for the description attribute appears to be in Python format. Instead of a normal string like "Zuverlässigkeit" you get "u'Zuverlässigkeit'".

This looks like the Python notation for UTF-8 strings. This currently only happens for some characters. We suspect it maybe related to description strings that contain Unicode letters.

The strings returned by the endpoint should not contain Python identifiers. In the current form any app has to manually resolve those strings. (Fun fact: Python apps can resolve those strings with ast.literal_eval(text))

Request

curl -X GET "https://esi.evetech.net/latest/characters/96344624/?datasource=tranquility" -H  "accept: application/json"

Response

Status Code

200

Headers

access-control-allow-credentials: true
access-control-allow-headers: Content-Type,Authorization,If-None-Match,X-User-Agent
access-control-allow-methods: GET,HEAD,OPTIONS
access-control-allow-origin: *
access-control-expose-headers: Content-Type,Warning,ETag,X-Pages,X-ESI-Error-Limit-Remain,X-ESI-Error-Limit-Reset
access-control-max-age: 600
allow: GET,HEAD,OPTIONS
cache-control: public
content-encoding: gzip
content-length: 770
content-type: application/json; charset=UTF-8
date: Mon, 14 Dec 2020 17:14:59 GMT
etag: "b095176fa31e990e93e5e8986063cbc856b3e1fc1236b83cd4908f2b"
expires: Tue, 15 Dec 2020 01:00:04 GMT
last-modified: Mon, 14 Dec 2020 01:00:04 GMT
strict-transport-security: max-age=31536000
vary: Accept-Encoding
x-esi-error-limit-remain: 100
x-esi-error-limit-reset: 1
x-esi-request-id: 6b06524d-1041-4ba4-9e15-a98743946096
x-firefox-spdy: h2 

Body

{
  "alliance_id": 99002367,
  "ancestry_id": 14,
  "birthday": "2014-02-06T19:04:50Z",
  "bloodline_id": 7,
  "corporation_id": 98000030,
  "description": "u'<font size=\"12\" color=\"#bfffffff\">Die Deus lo Vult will dich!<br><br>Wir sind eine kleine, starke Gemeinschaft bestehend aus Industriellen, Entdeckern, K\\xe4mpfern und J\\xe4gern. <br><br>Aktuell bauen wir alles neu auf, daher \\xe4ndern sich manche Dinge, im Kern sind wir aber eins: Ein Team. Jeder hat die gleichen Chancen und M\\xf6glichkeiten, niemand muss sich binden. F\\xfcr uns steht Spa\\xdf im Vordergrund.<br><br>Was wir nicht wollen:<br>Scammer, Piraten und sonstiges kriminelles Gesindel<br><br>Was erwartet wir von Dir?<br>\\xbb Bereitschaft zum VoiceCom (Mumble)<br>\\xbb Freundliche Umgangsformen<br>\\xbb Zuverl\\xe4ssigkeit, Eigeninitiative, Hilfsbereitschaft, Teamf\\xe4higkeit<br>Forenaktivit\\xe4t, zumindest lesenderweise!!<br>\\xbb Spa\\xdf am Spiel und Zeit daf\\xfcr. RL hat aber immer Vorrang!<br><br>Offentlicher Chat:  </font><font size=\"12\" color=\"#ff6868e1\"><a href=\"joinChannel:player_-23694601//None//None\">Deus-lo-Vult</a></font><font size=\"12\" color=\"#bfffffff\"> </font>'",
  "gender": "male",
  "name": "Adurai Shakrin",
  "race_id": 8,
  "security_status": 5.003861975
}

Expected

{
  "alliance_id": 99002367,
  "ancestry_id": 14,
  "birthday": "2014-02-06T19:04:50Z",
  "bloodline_id": 7,
  "corporation_id": 98000030,
  "description": "<font size=\"12\" color=\"#bfffffff\">Die Deus lo Vult will dich!<br><br>Wir sind eine kleine, starke Gemeinschaft bestehend aus Industriellen, Entdeckern, K\\xe4mpfern und J\\xe4gern. <br><br>Aktuell bauen wir alles neu auf, daher \\xe4ndern sich manche Dinge, im Kern sind wir aber eins: Ein Team. Jeder hat die gleichen Chancen und M\\xf6glichkeiten, niemand muss sich binden. F\\xfcr uns steht Spa\\xdf im Vordergrund.<br><br>Was wir nicht wollen:<br>Scammer, Piraten und sonstiges kriminelles Gesindel<br><br>Was erwartet wir von Dir?<br>\\xbb Bereitschaft zum VoiceCom (Mumble)<br>\\xbb Freundliche Umgangsformen<br>\\xbb Zuverl\\xe4ssigkeit, Eigeninitiative, Hilfsbereitschaft, Teamf\\xe4higkeit<br>Forenaktivit\\xe4t, zumindest lesenderweise!!<br>\\xbb Spa\\xdf am Spiel und Zeit daf\\xfcr. RL hat aber immer Vorrang!<br><br>Offentlicher Chat:  </font><font size=\"12\" color=\"#ff6868e1\"><a href=\"joinChannel:player_-23694601//None//None\">Deus-lo-Vult</a></font><font size=\"12\" color=\"#bfffffff\"> </font>",
  "gender": "male",
  "name": "Adurai Shakrin",
  "race_id": 8,
  "security_status": 5.003861975
}

Checklist

Check all boxes that apply to this issue:

mateuszkrasucki commented 3 years ago

@ErikKalkoken thank you for reporting. Internal issue EO-12177 has been created.

kkrabfir commented 3 years ago

Just encountered this as well. Here's an additional scenario if that helps:

curl -X GET "https://esi.evetech.net/latest/characters/96829083/?datasource=tranquility" -H "accept: application/json"

"description": "u'<font size=\"13\" color=\"#b3ffffff\"></font><font size=\"13\" color=\"#ffff0000\"> (\\\\/) (\\\\/)<br> \\\\\\\\ ( \\xb0 ,,,, \\xb0 ) //<br> /\\u203e/|\\\\ /|\\\\\\u203e\\\\<br>-------------------------<br>https://i.imgur.com/2PTRn0i.gif</font>'"

cvweiss commented 3 years ago

I work around this issue by directly altering the string and removing content between "description:" and the fields that come after. Then parse the JSON.

Unless you want to keep the description content for some reason, remove the problem.

kkrabfir commented 3 years ago

Unfortunately, I'm specifically looking for the description.

ErikKalkoken commented 2 years ago

Any update on when this bug will be fixed?

ErikKalkoken commented 2 years ago

Here is another recent example that has this bug: https://esi.evetech.net/latest/characters/96344624

ErikKalkoken commented 1 year ago

Sadly, this bug is still not fixed as of today.