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

  • Home
  • SEARCH
  • 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 8387101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:07:22+00:00 2026-06-09T18:07:22+00:00

EDIT: The error doesn’t appear in Prompt, but in the following Google App Engine

  • 0

EDIT: The error doesn’t appear in Prompt, but in the following Google App Engine environment.
Code execution environment
I have following json

>>>dat = r"""{"name":"Something", "data":"For youth \n\nBe a hero! Donate blood!\n\u091c\u092f \u0939\u093f\u0902\u0926! \u0935\u0928\u094d\u0926\u0947 \u092e\u093e\u0924\u0930\u092e\u094d"}"""

It contains unicode escaped characters.
I want to parse this. So I did

>>>jsDat = json.loads(js)

Then following works

>>>name = jsDat.get('name')
>>>name = name.encode('ascii') #This is because json module handles in unicode
>>>print name
Something

But trying for the field with unicode data, that is “data”, an error is displayed

>>>data = jsDat.get('data')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 366-367: ordinal not in range(128)

How should I parse the data?

  • 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-09T18:07:23+00:00Added an answer on June 9, 2026 at 6:07 pm

    You can’t encode unicode to ASCII if the characters exceed the ASCII character set. If you want to force the conversion, and lose data, you can do this:

    data = jsDat.get('data')
    data = data.encode('ascii', 'ignore')
    

    See the doc for str.encode for more details about the ignore.

    As an aside, I’m not sure why you’re trying to encode to ASCII – the JSON module seems to handle that raw string just fine?

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

Sidebar

Related Questions

I have List<HtmlAgilityPack.HtmlNode> but protobuf-net gives me error that it doesn't have a contract.
[Edit] I've summarized the answer to the following below, the error lies in the
edit/operacoes.php header('Content-Type: application/json'); include('../../lib/mysql.class.php'); $db = new MySQL(); if($db->Error()) $db->Kill(); //VARIÁVEIS DA FORM $id
we are getting the following error in almost all create or edit entity forms.
In a controller a error with Create/Edit ActionResult can be handled with a try-catch
I am getting a StackOverflow Error in this code: EDIT [XmlAttribute(ID)] public string ID
I am getting an error on my browser when i try to edit or
I have the following method in UIImageManipulation.m : +(UIImage *)scaleImage:(UIImage *)source toSize:(CGSize)size { UIImage
I have an app which is autostarting via BroadcastReceiver and is set as a
When I tried compiling my app for OS 3 I encountered an the following

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.