Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #85568

Re: urllib.parser.quote() and RFC 2396: unreserved characters get encoded

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.albasani.net!newsfeed.freenet.ag!newsfeed.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.83.MISMATCH!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'correct.': 0.07; 'encoded': 0.07; 'utf-8': 0.07; 'ascii': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:characters': 0.09; 'thus,': 0.09; 'url:faqs': 0.09; 'alphanum': 0.16; 'digits.': 0.16; 'non-ascii': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:skip:u 10': 0.16; 'url:rfcs': 0.16; "skip:' 30": 0.19; 'skip:p 40': 0.19; 'seems': 0.21; '>>>': 0.22; 'header:User-Agent:1': 0.23; '(by': 0.24; '2.1': 0.24; 'tells': 0.24; 'unicode': 0.24; 'handling': 0.26; 'defined': 0.27; 'header:X-Complaints-To:1': 0.27; '2.3': 0.30; 'characters': 0.30; 'writes:': 0.31; 'there': 0.35; 'url:org': 0.36; 'should': 0.36; 'e.g.': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'letters': 0.60; 'range': 0.61; 'received:217': 0.63; '8bit%:10': 0.64; 'legal': 0.71; 'to,': 0.72; 'subject:get': 0.81; '"".': 0.84; '1.6': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From dieter <dieter@handshake.de>
Subject Re: urllib.parser.quote() and RFC 2396: unreserved characters get encoded
Date Thu, 12 Feb 2015 07:48:06 +0100
References <CAMA3c48fpAm5n9-t-uEg51KmZdrvt=2cO-qcrFjY1-d43ozOgQ@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=euc-kr
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host pd9e0aa90.dip0.t-ipconnect.de
User-Agent Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux)
Cancel-Lock sha1:/ZTnEbszPxILwQ03RyweZLHulo8=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.18682.1423723696.18130.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1423723696 news.xs4all.nl 2898 [2001:888:2000:d::a6]:58781
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:85568

Show key headers only | View raw


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


Thread

Re: urllib.parser.quote() and RFC 2396: unreserved characters get encoded dieter <dieter@handshake.de> - 2015-02-12 07:48 +0100

csiph-web