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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:40:18+00:00 2026-06-11T20:40:18+00:00

Odd error with unicode for me. I was dealing with unicode fine, but when

  • 0

Odd error with unicode for me. I was dealing with unicode fine, but when I ran it this morning one item u’\u201d’ gave error and gives me

UnicodeError: ASCII encoding error: ordinal not in range(128)

I looked up the code and apparently its utf-32 but when I try to decode it in the interpreter:

c = u'\u201d'
c.decode('utf-32', 'replace')

Or any other operation with it for that matter, it just doesnt recognize it in any codec but yet I found it as “RIGHT DOUBLE QUOTATION MARK”

I get:

Traceback (most recent call last):
File "<pyshell#154>", line 1, in <module>
    c.decode('utf-32')
  File "C:\Python27\lib\encodings\utf_32.py", line 11, in decode
    return codecs.utf_32_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u201d' in position 0: ordinal not in range(128)
  • 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-11T20:40:19+00:00Added an answer on June 11, 2026 at 8:40 pm

    You already have a unicode string, there is no need to decode it to a unicode string again.

    What happens in that case is that python helpfully tries to first encode it for you, so that you can then decode it from utf-32. It uses the default encoding to do so, which happens to be ASCII. Here is an explicit encode to show you the exception raised in that case:

    >>> u'\u201d'.encode('ASCII')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    UnicodeEncodeError: 'ascii' codec can't encode character u'\u201d' in position 0: ordinal not in range(128)
    

    In short, when you have a unicode literal like u'', there is no need to decode it.

    Read up on the unicode, encodings, and default settings in the Python Unicode HOWTO. Another invaluable article on the subject is Joel Spolsky’s Minimun Unicode knowledge post.

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

Sidebar

Related Questions

My app used to run, but lately I've been getting this odd error: #
OK this is an odd error, as it's the first ajax page without any
I got this odd error and I can't figure out where it came from:
I'm getting this odd error in the preg_match() function: Warning: preg_match(): Compilation failed: range
I am having an odd error in my shell script. using this: $find /sys/class/
Has anyone ever seen this odd error when attempting to load an applet? I
My app continues to crash on startup with this odd error: -[UIApplication _preferredInterfaceOrientationGivenCurrentOrientation:]: unrecognized
I am having this odd error with my code. I am trying to troubleshoot
I'm having an odd error with one of my pages where the bar that
I'm trying to (cross-)compile node.js and I get this odd error that appears to

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.