Skip to content
Snippets Groups Projects
Commit 7238f906 authored by Rob Moss's avatar Rob Moss
Browse files

Python 3 defaults to UTF-8 source encoding

This replaces an out-dated guideline about declaring the source encoding
at the top of each source file.
parent 0b38e932
Branches
Tags
No related merge requests found
Pipeline #83505 passed
......@@ -16,14 +16,9 @@ To that end, adhere to the following guidelines:
+ Use Unicode strings and Unicode literals everywhere.
+ If you have non-ASCII characters in a Python source file (e.g., in Unicode
literals such as ``'α'``), you need to
`declare the file encoding <https://www.python.org/dev/peps/pep-0263/>`__ at
the top of the file:
+ Ensure that Python source files are saved as UTF-8 (the `default encoding <https://peps.python.org/pep-3120/>`__).
.. code-block:: python
# -*- coding: utf-8 -*-
+ If you need to use a different encoding for Python source files, you must `declare this encoding <https://www.python.org/dev/peps/pep-0263/>`__ at the top of each file.
+ Encode Unicode text into UTF-8 when writing to disk:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment