[issue13525] Tutorial: Example of Source Code Encoding triggers error

2018-05-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.6, Python 3.7, Python 3.8 -Python 3.2, Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13525] Tutorial: Example of Source Code Encoding triggers error

2018-05-09 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset d7e783b17feaedbe0f5b30467cb7f43cefadf904 by Serhiy Storchaka in 
branch '2.7':
[2.7] bpo-13525: Fix incorrect encoding name in the tutorial example. 
(GH-6738). (GH-6744)
https://github.com/python/cpython/commit/d7e783b17feaedbe0f5b30467cb7f43cefadf904


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13525] Tutorial: Example of Source Code Encoding triggers error

2018-05-09 Thread miss-islington

miss-islington  added the comment:


New changeset fa40fc0593012893e447875632e9ed3df277561f by Miss Islington (bot) 
in branch '3.6':
bpo-13525: Fix incorrect encoding name in the tutorial example. (GH-6738)
https://github.com/python/cpython/commit/fa40fc0593012893e447875632e9ed3df277561f


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13525] Tutorial: Example of Source Code Encoding triggers error

2018-05-09 Thread miss-islington

miss-islington  added the comment:


New changeset 834ea12ca6478d73a337ce52f33660f6f174 by Miss Islington (bot) 
in branch '3.7':
bpo-13525: Fix incorrect encoding name in the tutorial example. (GH-6738)
https://github.com/python/cpython/commit/834ea12ca6478d73a337ce52f33660f6f174


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13525] Tutorial: Example of Source Code Encoding triggers error

2018-05-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests: +6431

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13525] Tutorial: Example of Source Code Encoding triggers error

2018-05-09 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6430

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13525] Tutorial: Example of Source Code Encoding triggers error

2018-05-09 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6429

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13525] Tutorial: Example of Source Code Encoding triggers error

2018-05-09 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset ddb6215a55b0218b621d5cb755e9dfac8dab231a by Serhiy Storchaka in 
branch 'master':
bpo-13525: Fix incorrect encoding name in the tutorial example. (GH-6738)
https://github.com/python/cpython/commit/ddb6215a55b0218b621d5cb755e9dfac8dab231a


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13525] Tutorial: Example of Source Code Encoding triggers error

2018-05-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +6427
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13525] Tutorial: Example of Source Code Encoding triggers error

2018-05-09 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Error message was fixed. In all supported versions it is:

$ ./python cp_1252broken.py
  File "cp_1252broken.py", line 1
SyntaxError: encoding problem: cp-1252

But the tutorial still contains non-working example. This is an easy issue, but 
it was open for long time.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13525] Tutorial: Example of Source Code Encoding triggers error

2012-07-25 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
type:  - enhancement

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13525
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13525] Tutorial: Example of Source Code Encoding triggers error

2011-12-10 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Thanks for the detailed bug report.  I thought the normalization performed by 
the codec lookup system would convert 'cp-1252' to 'cp1252' (its “real” name, 
i.e. the name of the module implementing the codec), but it does not.  I’m +1 
to removing the hyphen in the example, then.

 Python raises the following exception:
 SyntaxError: encoding problem: with BOM
I reproduced this and it’s surprising.  Maybe there is a bug with error 
reporting here.

 Alternatively a totally other example as for Python 2.7 would be nice too
This file has seen different changes in 2.7 and 3.2, given that the default 
encoding is different in 3.x.  I’ll check the history and upload a patch here 
to get your feedback.

--
assignee: docs@python - eric.araujo
nosy: +eric.araujo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13525
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13525] Tutorial: Example of Source Code Encoding triggers error

2011-12-03 Thread Nicolas Goutte

New submission from Nicolas Goutte nicolas.gou...@extragroup.de:

Current Behaviour

The tutorial of Python 3.2.x has an example to set an encoding in a source 
file: http://docs.python.org/py3k/tutorial/interpreter.html#source-code-encoding

It explains to set the following line at the start of the source code:
# -*- coding: cp-1252 -*-

However when done exactly so, Python raises the following exception:
SyntaxError: encoding problem: with BOM

The problem seems to be that Python knows Windows codepage 1252 as windows-1252 
(its IANA charset name, see 
http://www.iana.org/assignments/charset-reg/windows-1252 ) or alternatively as 
cp1252 (without dash) but not as cp-1252 (with dash).

As this is an example in the tutorial is particularly problematic, as users 
might not understand how to do it correctly.

This is still the case in the tutorial of Python 3.3 alpha: 
http://docs.python.org/dev/tutorial/interpreter.html#source-code-encoding


Expected Behaviour

The tutorial should give a correct example, for example with:
# -*- coding: windows-1252 -*-

Alternatively a totally other example as for Python 2.7 would be nice too: 
http://docs.python.org/tutorial/interpreter.html#source-code-encoding


Notes:
I have tested this with following Python implementations:
- Python 3.2.1 (openSUSE 12.1) on Linux
- Python 3.2.2 on Windows 7 SP1 64 Bits
- Python 3.2.2 on MacOS 10.5.8
(Always on the command line; I have not tested in IDLE.)

--
assignee: docs@python
components: Documentation
files: cp_1252broken.py
messages: 148798
nosy: docs@python, nicolasg
priority: normal
severity: normal
status: open
title: Tutorial: Example of Source Code Encoding triggers error
versions: Python 3.2
Added file: http://bugs.python.org/file23840/cp_1252broken.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13525
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13525] Tutorial: Example of Source Code Encoding triggers error

2011-12-03 Thread Nicolas Goutte

Changes by Nicolas Goutte nicolas.gou...@extragroup.de:


Added file: http://bugs.python.org/file23841/windows_1252ok.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13525
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13525] Tutorial: Example of Source Code Encoding triggers error

2011-12-03 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti
stage:  - needs patch
versions: +Python 2.7, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13525
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com