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 6356157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:54:35+00:00 2026-05-24T22:54:35+00:00

I am using Solr 3.3 to index stuff from my database. I compose the

  • 0

I am using Solr 3.3 to index stuff from my database. I compose the JSON content in Python. I manage to upload 2126 records which add up to 523246 chars (approx 511kb). But when I try 2027 records, Python gives me the error:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "D:\Technovia\db_indexer\solr_update.py", line 69, in upload_service_details
    request_string.append(param_list)
  File "C:\Python27\lib\json\__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "C:\Python27\lib\json\encoder.py", line 203, in encode
    chunks = list(chunks)
  File "C:\Python27\lib\json\encoder.py", line 425, in _iterencode
    for chunk in _iterencode_list(o, _current_indent_level):
  File "C:\Python27\lib\json\encoder.py", line 326, in _iterencode_list
    for chunk in chunks:
  File "C:\Python27\lib\json\encoder.py", line 384, in _iterencode_dict
    yield _encoder(value)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x96 in position 68: invalid start byte 

Ouch. Is 512kb worth of bytes a fundamental limit? Is there any high-volume alternative to the existing JSON module?


Update: its a fault of some data as trying to encode *biz_list[2126:]* causes an immediate error. Here is the offending piece:

‘2nd Floor, Gurumadhavendra Towers,\nKadavanthra Road, Kaloor,\nCochin \x96 682 017′

How can I configure it so that it can be encodable into JSON?


Update 2: The answer worked as expected: the data came from a MySQL table encoded in “latin-1-swedish-ci”. I saw significance in a random number. Sorry for spontaneously channeling the spirit of a headline writer when diagnosing the fault.

  • 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-05-24T22:54:36+00:00Added an answer on May 24, 2026 at 10:54 pm

    Simple, just don’t use utf-8 encoding if your data is not in utf-8

    >>> json.loads('["\x96"]')
    ....
    UnicodeDecodeError: 'utf8' codec can't decode byte 0x96 in position 0: invalid start byte
    
    >>> json.loads('["\x96"]', encoding="latin-1")
    [u'\x96']
    

    json.loads

    If s is a str instance and is encoded with an ASCII based
    encoding other than utf-8 (e.g. latin-1) then an appropriate
    encoding name must be specified. Encodings that are not ASCII
    based (such as UCS-2) are not allowed and should be decoded to
    unicode first.

    Edit: To get proper unicode value of “\x96” use “cp1252” as Eli Collins mentioned

    >>> json.loads('["\x96"]', encoding="cp1252")
    [u'\u2013']
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using SolrNET to manage my Solr index. After I updated the schema with
I am using solr search engine to query an index for classifieds that match
How do I pick/ delete all the documents from Solr using the boolean NOT
I'm using RoR + acts_as_solr to query a Solr database. I'm used to using
Afternoon guys, I'm using a SOLR index for searching through items on my site.
I got indexed a Mysql database using Solr and everything is perfect. Now i
Let's say I want to index my shop using Solr Lucene. I have many
I am using the Spring RestTemplate to make calls to a Apache Solr index.
I am using Sunspot/Solr to index my Rails website. I index City name by
I have in my database or Solr index the following 2 Products: Total War:

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.