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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:10:56+00:00 2026-06-13T14:10:56+00:00

I’m having some trouble making my website compatible with accented characters (french website). I

  • 0

I’m having some trouble making my website compatible with accented characters (french website).

I have a form where some field values can be with accented chars: “Coupé” for instance.

My URL looks like this:

http://localhost:8080/recherches/s?marque=Audi&modeles=A5+Coup%C3%A9

In my django view I do something like this:

def search(request):
  logger = logging.getLogger('custom')
  criteria_form = CriteriaForm(request.GET or None)
  logger.debug("search")
  logger.debug(request.GET)

And what I get in my logs is:

<QueryDict: {u'marque': [u'Audi'], u'modeles': [u'A5 Coup\xc3\xa9']}>

If I query my database with this variable “modeles”, I get an error:

>>> mo = u'A5 Coup\xc3\xa9'
>>> Vehicule.objects.filter(valid=True, modele=mo)[0].marque.name
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 211, in __getitem__
    return list(qs)[0]
IndexError: list index out of range

Things work if I query the database with the utf-8 version:

>>> mo = 'A5 Coup\xc3\xa9'
>>> Vehicule.objects.filter(valid=True, modele=mo)[0].marque.name
u'Audi'

So I think (but I might be wrong) that my problem comes from the fact that my variable is utf8 and then encoded with unicode.

How comes this is encoded that way?

UPDATE AFTER 1st RESPONSE:

On the header of the page that sends the form there is:

<meta http-equiv="Content-type" content="text/html;charset=UTF-8"/>

However if I print in my views.py the encoding:

logger.debug(request.encoding)

Then I get None.

But I don’t know how to setup this encoding. I thought it would be from the header like I did above…

Also I have that in my HTTP_ACCEPT_CHARSET:

HTTP_ACCEPT_CHARSET ISO-8859-1,utf-8;q=0.7,*;q=0.3

Can that come from here? If yes, how should I change that?

  • 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-13T14:10:57+00:00Added an answer on June 13, 2026 at 2:10 pm

    I have finally found the problem. I tested this problem with a brand new django application with nearly nothing in it. No DB, a simple view which displayed the content of the form in a page.
    Something like this:

    # -*- coding: utf-8 -*-
    from django.shortcuts import render_to_response
    from django.template import RequestContext
    
    
    def test(request):
      found = request.GET.get('modeles')
      print found
      return render_to_response('test.html',
                                {"found":found},
                                context_instance=RequestContext(request))
    

    And if I opened the url

    localhost:8080/mysite?modeles=Coupé
    

    I was getting the wrongly formatted Coupé

    Here for sure I could not blame any ajax, or db call or anything I could have done in python.

    So I just tried it with Django 1.4… And it worked like a charm!
    Then I tried with the latest Django 1.5a1 version and it also worked…

    I guess I should not use the beta for now. I will stick with the 1.4!

    Hope this saves time for somebody else.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a text area in my form which accepts all possible characters from
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I want to count how many characters a certain string has in PHP, but
I have a small JavaScript validation script that validates inputs based on Regex. I

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.