Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #85568
| From | dieter <dieter@handshake.de> |
|---|---|
| Subject | Re: urllib.parser.quote() and RFC 2396: unreserved characters get encoded |
| Date | 2015-02-12 07:48 +0100 |
| References | <CAMA3c48fpAm5n9-t-uEg51KmZdrvt=2cO-qcrFjY1-d43ozOgQ@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.18682.1423723696.18130.python-list@python.org> (permalink) |
Bruno Cauet <brunocauet@gmail.com> writes:
> Unicode characters outside the ASCII range also get encoded when they
> have no reason to, e.g.
> >>> pathlib.PurePath("/home/싸이/").as_uri()
> 'file:///home/%EC%8B%B8%EC%9D%B4'
Non-ASCII characters are not legal uri characters.
Look at section 2.3 of "http://www.faqs.org/rfcs/rfc2396.html".
You see there "unreserved = alphanum | mark" with with "alphanum"
defined in section 1.6 as the ASCII letters and digits.
See also section 2.1 ("URI and non-ASCII characters"). It tells
that non-ASCII characters should be utf-8 encoded and then uri-escaped.
Thus, the handling (by "urllib")
of non-ASCII unicode characters seems to be correct.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: urllib.parser.quote() and RFC 2396: unreserved characters get encoded dieter <dieter@handshake.de> - 2015-02-12 07:48 +0100
csiph-web