Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9155011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:31:17+00:00 2026-06-17T12:31:17+00:00

I am trying to return JSON from the API service from musicbrainz, the returned

  • 0

I am trying to return JSON from the API service from musicbrainz, the returned data for some songs have unicode characters which I am having trouble converting them to regular symbols etc. Kindly let me know what I should be doing here.

JSON:

{
    "status": "ok",
    "results": [{
        "recordings": [{
            "duration": 402,
            "tracks": [{
                "duration": 402,
                "position": 6,
                "medium": {
                    "release": {
                        "id": "dde6ecee-8e9b-4b46-8c28-0f8d659f83ac",
                        "title": "Tecno Fes, Volume 2"
                    },
                    "position": 1,
                    "track_count": 11
                },
                "artists": [{
                    "id": "57c1e5ea-e08f-413a-bcb1-f4e4b675bead",
                    "name": "Gigi D\u2019Agostino"
                }],
                "title": "You Spin Me Round"
            }],
            "id": "2e0a7bce-9e44-4a63-a789-e8c4d2a12af9"
        }, ....

Failed Code (example):

string = '\u0420\u043e\u0441\u0441\u0438\u044f'
print string.encode('utf-8')

I am using this on a windows 7 machine and have python 2.7 and running this code on a command line terminal.. I have the output I get below:

C:\Python27>python junk.py Gigi DGÇÖAgostino Gigi D?Agostino Gigi D\u2019Agostino

I am expecting the output to be Gigi D' Agostino

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:31:18+00:00Added an answer on June 17, 2026 at 12:31 pm

    You are using the cmd in Windows? In that case it might be a bit of a hack to get Unicode working at all to display correctly.
    You might want to think about using another “terminal” to test your scripts.
    MSYS provides a nice terminal/shell and IDLE is included in the Windows Python distribution and has a Python Shell (right click, open in IDLE, F5).

    If you really want to make it work in the cmd:

    You have to set Lucida Console as font in cmd. Then:

    > chcp
    Active code page: 850
    > chcp 65001
    

    Then you should have unicode output in the cmd. Your “Active code page” might be different. Note that somewhere, because you might want to change it back afterwards:

    > chcp 850
    

    Otherwise you will run into other problems (starting .bat files doesn’t work).
    (See also batch-file-encoding)

    In your script you also need this:

    import codecs
    
    def cp65001(name):
        """This might be buggy, but better than just a LookupError
        """
        if name.lower() == "cp65001":
            return codecs.lookup("utf-8")
    
    codecs.register(cp65001)
    

    Otherwise python will crash. (see windows-cmd-encoding-change-causes-python-crash)

    I had a similar bug report for my script.


    You might also consider using a library to access the MusicBrainz Web Service.
    Python-musicbrainzngs works with the current ws/2.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to append some JSON data from the last.fm API, I have been
Im trying to append some JSON data from the last.fm API, I have been
I am trying to return two json sets from java which each contain key/value
I'm trying to read data from a service (returns JSON object) and create an
I am trying to download some JSON from the google book API. The URL
I'm trying to return some data from twitter's JSONP results. I'm then trying to
I have a data Store that gets it's information from a JSON api on
I'm trying to collect some data from an opendata service. i'm stuck with my
i am noticing a error when im trying to return json from a fetchAll.
I'm trying to return a JSON response from a Django view call via an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.