0

I got this code in this answer: Set Python27 Google AppEngine default encoding for entire app

#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

Do I have to do this just in main.py (file with request handlers) or to every single python file that I create?

Community
  • 1
  • 1
Albert
  • 3,611
  • 3
  • 28
  • 52
  • Some good insights also in here: https://pythonhosted.org/kitchen/unicode-frustrations.html – Albert May 03 '14 at 05:50

1 Answers1

0

Yes, like the from __future__ import line the # coding line only ever applies to the file it is placed in.

Python uses it when compiling the source file to bytecode, and you are free to use different encodings for different source files should you so wish.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343