Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98986
| Path | csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Christian Gollwitzer <auriocus@gmx.de> |
| Newsgroups | comp.lang.python |
| Subject | Re: handling of non-ASCII filenames? |
| Date | Wed, 18 Nov 2015 18:22:05 +0100 |
| Organization | A noiseless patient Spider |
| Lines | 21 |
| Message-ID | <n2ibvh$5th$1@dont-email.me> (permalink) |
| References | <n2i9vt$icf$1@news2.informatik.uni-stuttgart.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=iso-8859-15; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Wed, 18 Nov 2015 17:19:45 -0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="6df432b49f340412b809a16769ee84df"; logging-data="6065"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18/FjOUM1qem6ILc4vA+Gy6Tu8ObbpI2a4=" |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
| In-Reply-To | <n2i9vt$icf$1@news2.informatik.uni-stuttgart.de> |
| Cancel-Lock | sha1:DcZF4yzaJ7g1Tzd2+uve8PywGX0= |
| Xref | csiph.com comp.lang.python:98986 |
Show key headers only | View raw
Am 18.11.15 um 17:45 schrieb Ulli Horlacher:
> This is my encoding function:
>
> def url_encode(s):
> u = ''
> for c in list(s):
> if match(r'[_=:,;<>()+.\w\-]',c):
> u += c
> else:
> u += '%' + c.encode("hex").upper()
> return u
>
>
The quoting is applied to a UTF8 string. But I think you shouldn't do it
yourself, use a library function:
import urllib
urllib.quote(yourstring.encode('utf8'))
Christian
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
handling of non-ASCII filenames? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-11-18 16:45 +0000
Re: handling of non-ASCII filenames? Chris Angelico <rosuav@gmail.com> - 2015-11-19 03:54 +1100
Re: handling of non-ASCII filenames? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-11-18 18:09 +0000
Re: handling of non-ASCII filenames? Chris Angelico <rosuav@gmail.com> - 2015-11-19 07:29 +1100
Re: handling of non-ASCII filenames? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-11-18 22:37 +0000
Re: handling of non-ASCII filenames? Christian Gollwitzer <auriocus@gmx.de> - 2015-11-18 18:22 +0100
Re: handling of non-ASCII filenames? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-11-19 07:54 +0000
Re: handling of non-ASCII filenames? Christian Gollwitzer <auriocus@gmx.de> - 2015-11-19 09:16 +0100
csiph-web