Slavus programing blog

My random programing (and other) tips.

Python Source File Encoding Hint

| Comments

When I program in Python I have bad habit writing comments in Croatian. When using characters like šđčžž i get some stupid errors. Some thing like this:

SyntaxError: Non-ASCII character '\xc4' in file

I know I have write first special comment, to tell Python I am writing in UTF-8., but I always forget what exactly I have to write. So here it is:

1
# -*- coding: utf-8 -*-

Comments