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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:44:36+00:00 2026-05-25T12:44:36+00:00

I’m trying to send latin characters (é, è…) to the client side using Django,

  • 0

I’m trying to send latin characters (é, è…) to the client side using Django, and I can’t get it to work. In Django I tried to write directly latin characters in my python files, but I had errors. I then used unicode (writing ‘Soci\u00E9t\u00E9’ for ‘Société’), but when sending it to the client side I get the raw unicode characters.

Can anybody help?

Julien

  • 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-25T12:44:37+00:00Added an answer on May 25, 2026 at 12:44 pm

    I would generally refrain from putting any non-ascii encoded characters in source code.

    Despite the fact that the python interpreter will honor a source file with the UTF-8 header, the problem is that dumb (meaning non UTF-8 aware) text editors, shells, OSes and some developers :), will eventually corrupt your carefully crafted unicode strings.

    I would stay to an ASCII only character set in any source file, since that is pretty much universally supported everywhere and thus you won’t run into source code corruption.

    You are almost there with your unicode escaped string.

    In python you simply need to put a u in front.

    i.e.
    u’Soci\u00E9t\u00E9′

    Otherwise, python would treat most of the characters above as literal characters rather than your intended unicode escape characters.

    An easy way to test the correctness of your unicode encoded string or binary string (which is a string without a u in front of it) is to fire up a python interpreter and print it:

    >>> print 'Soci\u00E9t\u00E9'
    Soci\u00E9t\u00E9           #ewwwwwww
    >>> print u'Soci\u00E9t\u00E9'
    Société                     #yay!!!
    

    Note: For the above test, your shell better support UTF-8 (if you are logged in locally on a Mac it probably is)… otherwise the print output will be gibberish. That is fine, as well as it is the correct gibberish (meaning, your input string was formatted in the ideal sense).

    Unless you have some middleware or other methods not properly dealing with unicode in between your view function and rendering, Django should properly output your unicode string just fine.

    BTW, it is a good practice to prefix all your strings with u.
    u’this is a test’ is just as good as ‘this is a test’.

    The difference is that, any string manipulation operations involving a unicode designated string (such as u’this’ + ‘ a ‘ + ‘test’), will tell python to be unicode aware.

    Yes, python in a sense, defaults to be unicode dumb. Just like some text editors! 🙂

    ‘u’, the magic sauce

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:

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.