cpython icon indicating copy to clipboard operation
cpython copied to clipboard

Whats new: Obligatory source code encodings if not ASCII

Open rnd0110 opened this issue 23 years ago • 2 comments

BPO 683416
Nosy @akuchling

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/akuchling'
closed_at = <Date 2003-02-18.00:51:26.000>
created_at = <Date 2003-02-09.14:52:29.000>
labels = ['docs']
title = 'Whats new: Obligatory source code encodings if not ASCII'
updated_at = <Date 2003-02-18.00:51:26.000>
user = 'https://bugs.python.org/rnd0110'

bugs.python.org fields:

activity = <Date 2003-02-18.00:51:26.000>
actor = 'akuchling'
assignee = 'akuchling'
closed = True
closed_date = None
closer = None
components = ['Documentation']
creation = <Date 2003-02-09.14:52:29.000>
creator = 'rnd0110'
dependencies = []
files = []
hgrepos = []
issue_num = 683416
keywords = []
message_count = 2.0
messages = ['14528', '14529']
nosy_count = 2.0
nosy_names = ['akuchling', 'rnd0110']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue683416'
versions = ['Python 2.3']

rnd0110 avatar Feb 09 '03 14:02 rnd0110

As per PEP-263, source code encoding cookie is a must for source code file. This fact is not stressed enough in the documentation.

I think, these sections must be changed to reflect PEP-263:

What's new in Python 2.3

Section 3: PEP-263 Source Code Encoding must inform the reader on this:

Source files which use non-ASCII characters and do not have encoding declaration are phased out. Python 2.3 gives DeprecationWarnings. Later versions will give SyntraxError instead.

13.1 String changes

Unicode literals can now contain characters of the source file encoding if such was specified (see PEP-263).

18 Porting to Python 2.3 section needs addition:

  • to avoid DeprecationWarnings, add encoding declaration to all source files according to PEP-263, if they are using non-ASCII characters. After that, Unicode strings could be specified with symbols from specified encoding.

(Please correct my English, as it is not native)

(I'll look into other docs and submit corrections to them separately)

rnd0110 avatar Feb 09 '03 14:02 rnd0110

Logged In: YES user_id=11375

Updated; thanks!

akuchling avatar Feb 18 '03 00:02 akuchling