Skip to content

Instantly share code, notes, and snippets.

@peterbe
Created June 26, 2019 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterbe/fd01d462e3844d7104444ecb9cf561aa to your computer and use it in GitHub Desktop.
Save peterbe/fd01d462e3844d7104444ecb9cf561aa to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
print(u'Pétër')
print(u'Pétër')
@peterbe
Copy link
Author

peterbe commented Jun 26, 2019

▶ ls
backwardscompat.py justpython3.py

▶ python2 backwardscompat.py
Pétër

▶ python3 backwardscompat.py
Pétër

▶ python3 justpython3.py
Pétër

▶ python2 justpython3.py
  File "justpython3.py", line 1
SyntaxError: Non-ASCII character '\xc3' in file justpython3.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment