2

I am getting this error:

SyntaxError at /
Non-ASCII character '\xe6' in file

pointed to my forms.py file which has some chinese characters

I have to put # -*- coding: utf-8 -*- at the start the forms.py file before it would work

I thought Django handles everything in unicode? What's wrong?

1 Answer 1

6

Nothing is wrong. You have done the correct thing. If you want to use non-ASCII characters in your code, you need to tell Python what encoding you are using.

This has nothing to do with Django, or Unicode.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.