1

Here is the query

RESULT

    {
    "items": [
        {
            "badge_counts": {
                "bronze": 2,
                "silver": 1,
                "gold": 0
            },
            "view_count": 2,
            "down_vote_count": 0,
            "up_vote_count": 12,
            "answer_count": 1,
            "question_count": 0,
            "account_id": 1094354,
            "is_employee": false,
            "last_modified_date": 1447469978,
            "last_access_date": 1468508841,
            "reputation_change_year": 0,
            "reputation_change_quarter": 0,
            "reputation_change_month": 0,
            "reputation_change_week": 0,
            "reputation_change_day": 0,
            "reputation": 36,
            "creation_date": 1323366965,
            "user_type": "registered",
            "user_id": 1088280,
            "about_me": "",
            "website_url": "",
            "link": "https://stackoverflow.com/users/1088280/onurguven",
            "profile_image": "https://www.gravatar.com/avatar/8a9f2e211fc1467000c13e9669d1bfac?s=128&d=identicon&r=PG",
            "display_name": "onurguven"
        },
        {
            "badge_counts": {
                "bronze": 6,
                "silver": 0,
                "gold": 0
            },
            "view_count": 5,
            "down_vote_count": 0,
            "up_vote_count": 4,
            "answer_count": 2,
            "question_count": 1,
            "account_id": 6550820,
            "is_employee": false,
            "last_modified_date": 1500780894,
            "last_access_date": 1503448756,
            "reputation_change_year": 26,
            "reputation_change_quarter": 26,
            "reputation_change_month": 0,
            "reputation_change_week": 0,
            "reputation_change_day": 0,
            "reputation": 27,
            "creation_date": 1435665686,
            "user_type": "registered",
            "user_id": 5065301,
            "about_me": "<p>Hello, I am Onur Osman Güle.</p>\n\n<p>I am 17.</p>\n\n<p>I am from Turkey.</p>\n\n<p>Curious to learn programming languages.</p>\n\n<p>I am going to be a computer engineer.</p>\n",
            "location": "İstanbul, T&#252;rkiye",
            "website_url": "http://onurgule.com.tr",
            "link": "https://stackoverflow.com/users/5065301/onurgule",
            "profile_image": "https://i.sstatic.net/4LmSt.jpg?s=128&g=1",
            "display_name": "Onurgule"
        },
        {
            "badge_counts": {
                "bronze": 2,
                "silver": 0,
                "gold": 0
            },
            "view_count": 2,
            "down_vote_count": 0,
            "up_vote_count": 0,
            "answer_count": 0,
            "question_count": 3,
            "account_id": 3804407,
            "is_employee": false,
            "last_modified_date": 1388752189,
            "last_access_date": 1423972510,
            "reputation_change_year": 0,
            "reputation_change_quarter": 0,
            "reputation_change_month": 0,
            "reputation_change_week": 0,
            "reputation_change_day": 0,
            "reputation": 7,
            "creation_date": 1388752138,
            "user_type": "registered",
            "user_id": 3157211,
            "about_me": "",
            "website_url": "",
            "link": "https://stackoverflow.com/users/3157211/s-onurgul",
            "profile_image": "https://www.gravatar.com/avatar/2cf9ea703b9c69976bfce7ec0aa4e2e1?s=128&d=identicon&r=PG&f=1",
            "display_name": "s.onurgul"
        }
    ],
    "has_more": false,
    "quota_max": 10000,
    "quota_remaining": 9999
}

Location

How it is returned

"location": "İstanbul, T&#252;rkiye"

How it should be returned

"location": "İstanbul, Türkiye"

If you look at the location of user you'll see that the character ü is being shown as &#252;

Whereas, on the profile page, location is shown as how it should be.

SOLUTION

import html

html.unescape()

enter image description here

1 Answer 1

1

That data is stored as HTML in the database, as are more fields (e.g. the about_me field right above the location). Presumably, this is done for performance reasons. &#252; is the HTML entity corresponding to ü. You just have to decode the string; every programming language has a method for this, e.g. html.unencode() in Python.

By the way, it's strange that the İ character is not stored as an HTML entity.

2
  • thats what confuses me. Commented Aug 23, 2017 at 12:02
  • Maybe ü is more common and so is in some "translate this to HTML table", while İ is rarer and slipped through that filter (which may not be needed in a wall-to-wall UTF8 system)? Really need a dev to answer this one... Commented Aug 23, 2017 at 13:55

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.