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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:34:59+00:00 2026-05-30T06:34:59+00:00

I am using lxml to get a string from a web page. What do

  • 0

I am using lxml to get a string from a web page. What do I have to do to get a string of the data that I extract without having the below error? I guess I just can’t using str() to solve the problem.

In python:

mystring = MySQLdb.escape_string(i.text_content())


(<type 'exceptions.UnicodeEncodeError'>, UnicodeEncodeError('ascii', u"\n\nEve Pownall\n\n  \n    \n    \n    \n        Eve Pownall\n\t  (Author)\n\t\n        \u203a Visit Amazon's Eve Pownall Page\n        Find all the books, read about the author, and more.\n\n         See search results for this author  \n        Are you an author?\n        Learn about Author Central\n        \n      \n   \n  \n\n  \n      amznJQ.onReady('bylinePopover', function () {});\n  \n\n\n (Author)\n\n\n\n\n\n\n\n\n\n\n", 75, 76, 'ordinal not in range(128)'), <traceback object at 0x7f225c99f050>)
  • 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-30T06:35:00+00:00Added an answer on May 30, 2026 at 6:35 am

    You need to explicitly encode the string in a good known encoding (UTF-8 most likely).

    More info:

    http://collective-docs.readthedocs.org/en/latest/troubleshooting/unicode.html

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

Sidebar

Related Questions

I have an xml file that I'm using etree from lxml to work with,
I am using lxml for parsing xml data. I have to divide the xml
I have a strange problem with lxml when using the deployed version of my
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
I'm using lxml as follows to parse an exported XML file from another system:
This follows my previous questions on using lxml and Python. I have a question,
hi all I'm trying to extract the META description from a webpage using libxml
I am using lxml to parse xml I got from amazon product advertisement API.
I'm writing a web scraper in python, using httplib2 and lxml (yes - I
i want to select the following strings from this html using just lxml and

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.