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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:02:55+00:00 2026-06-09T13:02:55+00:00

I’ve been using a psql/django stack for my application for a while under Windows

  • 0

I’ve been using a psql/django stack for my application for a while under Windows without any problem at all.

However, recently I switched to a linux box and many places started breaking up. Being a spanish speaker my application uses a lot of special characters like “á” or “ñ”. Naturally, I decided that my database and default_encoding should be UTF-8 to avoid any funny problems.

Nonetheless, even though the application had no problem displaying objects who had special characters, the admin started having many problems. Whenever an element whose display name had special characters was fetched, I’d get a dreaded:

UnicodeDecodeError at /ajax_select/ajax_lookup/images
'ascii' codec can't decode byte 0xc3 in position 35: ordinal not in range(128)

Essentially, Django tries to get the unicode() of those elements and fails miserably. I might be missing something, because it has no such problem in my windows box, so, essentially:

  1. PostgreSQL database encoding is UTF-8 in both places (character type and collation are not EXACTLY the same, but I don’t think that should make any difference: English_United States.1252 vs. en_US.UTF-8

  2. Apache is not the culprit (nor I don’t see how it could be) as this happens with the django development server too.

  3. Django defaults to UTF-8, which is true because as I said, I can see the special characters perfectly in other places of the application, it just fails in a few specific scenarios with the admin.

I’ve ran out of ideas as to what should be and as the errors lie in the midst of the django admin code it’s hard to debug, but mostly it crashes in an str() or unicode() function.

Core of the issue is: In windows str('árbol') = ‘árbol’. In Linux str('árbol') crashes.

Any ideas would be really appreciated.

  • 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-09T13:02:56+00:00Added an answer on June 9, 2026 at 1:02 pm

    I’ve solved it horribly by using django’s smart_str() every string that may have a weird character and applying a replace filter to that new string so that every character would be replaced by its ascii equivalent. It worked for the most part, yet it made some code look hideous. Ahh, c’est la vie.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a text area in my form which accepts all possible characters from

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.