Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Since you cited PEP-263, read carefully the regular expression it gives for what the coding line should match:

^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)

specifically, the string coding should be immediately followed by a : or =, no whitespace. The encoding name UTF-8 is fine since encoding names are not case-sensitive.

The most common way to write this is:

```

-- coding: utf-8 --

Since you cited PEP-263, read carefully the regular expression it gives for what the coding line should match:

^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)

specifically, the string coding should be immediately followed by a : or =, no whitespace. The encoding name UTF-8 is fine since encoding names are not case-sensitive.

The most common way to write this is:

```

-- coding: utf-8 --

```

Since you cited PEP-263, read carefully the regular expression it gives for what the coding line should match:

^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)

specifically, the string coding should be immediately followed by a : or =, no whitespace. The encoding name UTF-8 is fine since encoding names are not case-sensitive.

The most common way to write this is:

```

-- coding: utf-8 --

```

Since you cited PEP-263, read carefully the regular expression it gives for what the coding line should match:

^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)

specifically, the string coding should be immediately followed by a : or =, no whitespace. The encoding name UTF-8 is fine since encoding names are not case-sensitive.

The most common way to write this is:

```

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

-*-

```

Since you cited PEP-263, read carefully the regular expression it gives for what the coding line should match:

^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)

specifically, the string coding should be immediately followed by a : or =, no whitespace. The encoding name UTF-8 is fine since encoding names are not case-sensitive.

The most common way to write this is:

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

Note: Since this is just a standard Python feature it is not specific to Sage, so you could also likely find answers to your problem on StackOverflow or any other source for Python help.