This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: netrc does not handle accentuated characters
Type: behavior Stage: test needed
Components: Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: open Resolution:
Dependencies: 28806 Superseder:
Assigned To: Nosy List: ajaksu2, amaury.forgeotdarc, asvetlov, drzraf, r.david.murray, xiang.zhang
Priority: normal Keywords:

Created on 2012-05-17 21:23 by drzraf, last changed 2022-04-11 14:57 by admin.

Messages (6)
msg161016 - (view) Author: Raphaël Droz (drzraf) Date: 2012-05-17 21:23
Accentuated characters are not accepted in password.
While it (unicode) was quickly talked about in issue557704 it appears that issue1170 aimed to solve this by making shlex unicode-compatible but it does not seem to be the case (at least with python 3.2 in the netrc use-case).

On a side note :
- a blank line between two comment lines
 and
- lines starting with a '#' *not* followed by a space
 fail too (shells supports both of them)
msg161288 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2012-05-21 19:08
Do you have a small script to reproduce the issue?
msg161343 - (view) Author: Raphaël Droz (drzraf) Date: 2012-05-22 09:14
$ python -c "import netrc; print netrc.netrc('/dev/stdin').authenticators('a')"<<<"machine a login b password c"
('b', None, 'c')

$ python -c "import netrc; print netrc.netrc('/dev/stdin').authenticators('a')"<<<"machine a login b password héhé"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/netrc.py", line 32, in __init__
    self._parse(file, fp)
  File "/usr/lib/python2.7/netrc.py", line 94, in _parse
    file, lexer.lineno)
netrc.NetrcParseError: bad follower token '\xc3' (/dev/stdin, line 1)
msg161350 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-05-22 13:55
This is presumably going to turn out to be a problem with shlex's handling of non-ascii characters.  I believe there are open issues about that, but I'm not sure of the status.
msg281843 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2016-11-28 05:03
I opened #28806 to improve netrc library. This could be solved if it's merged.
msg409224 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2021-12-27 02:28
Now that a PR has landed in #28806 to improve shlex, we need to check whether this issue can/needs to move forward.
History
Date User Action Args
2022-04-11 14:57:30adminsetgithub: 59049
2021-12-27 02:28:28ajaksu2setversions: + Python 3.9, Python 3.10, Python 3.11, - Python 3.2
nosy: + asvetlov, ajaksu2

messages: + msg409224

type: behavior
2016-11-28 05:03:36xiang.zhangsetnosy: + xiang.zhang
dependencies: + Improve the netrc library
messages: + msg281843
2012-05-22 13:55:21r.david.murraysetnosy: + r.david.murray
messages: + msg161350
2012-05-22 09:14:14drzrafsetmessages: + msg161343
2012-05-21 19:08:46amaury.forgeotdarcsetnosy: + amaury.forgeotdarc

messages: + msg161288
stage: test needed
2012-05-17 21:23:44drzrafcreate