Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #64586
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.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; 'from:addr:yahoo.co.uk': 0.04; 'say,': 0.05; 'string': 0.09; 'janvier': 0.09; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'def': 0.12; 'language.': 0.14; '"is': 0.16; 'handled.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'stuff.': 0.16; 'subject:unicode': 0.16; 'language': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'task': 0.26; 'skip:" 20': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply- To:1': 0.27; 'characters': 0.30; 'assert': 0.31; 'lies': 0.31; 'txt': 0.31; 'with,': 0.31; 'could': 0.34; 'done': 0.36; 'being': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; "you'll": 0.62; 'email addr:gmail.com': 0.63; 'skip:n 10': 0.64; 'our': 0.64; 'interest': 0.64 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
| Subject | Re: awesome slugify and unicode |
| Date | Thu, 23 Jan 2014 09:14:48 +0000 |
| References | <mailman.5850.1390418639.18130.python-list@python.org> <59461353-d450-471f-ae28-84f686543a57@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Gmane-NNTP-Posting-Host | host-92-24-222-18.ppp.as43234.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
| In-Reply-To | <59461353-d450-471f-ae28-84f686543a57@googlegroups.com> |
| 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.5878.1390468510.18130.python-list@python.org> (permalink) |
| Lines | 39 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1390468510 news.xs4all.nl 2884 [2001:888:2000:d::a6]:35377 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:64586 |
Show key headers only | View raw
On 23/01/2014 07:18, wxjmfauth@gmail.com wrote:
> Le mercredi 22 janvier 2014 20:23:55 UTC+1, Mark Lawrence a écrit :
>> I thought this blog might interest some of you
>>
>> http://pydanny.com/awesome-slugify-human-readable-url-slugs-from-any-string.html
>>
>> My fellow Pythonistas, ask not what our language can do for you, ask
>>
>> what you can do for our language.
>>
>
> This is not "unicode", only string manipulations.
> The same work could be done with, let say, cp1252.
> The difference lies in the repertoires of characters
> to be handled.
>
> A better way is to work with normalization() and/or
> with methods like .translate() with dedicated
> tables; the hard task being the creation of these tables.
>
> Shortly, very naive.
>
> jmf
>
You'll have to excuse my ignorance of this stuff. How do I express the
following in cp1252?
def test_musical_notes():
txt = "Is ♬ ♫ ♪ ♩ a melody or just noise?"
assert slugify(txt) == "Is-a-melody-or-just-noise"
assert slugify_unicode(txt) == "Is-a-melody-or-just-noise"
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
awesome slugify and unicode Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-22 19:23 +0000
Re: awesome slugify and unicode wxjmfauth@gmail.com - 2014-01-22 23:18 -0800
Re: awesome slugify and unicode Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-23 09:14 +0000
Re: awesome slugify and unicode wxjmfauth@gmail.com - 2014-01-23 02:41 -0800
Re: awesome slugify and unicode Chris Angelico <rosuav@gmail.com> - 2014-01-23 21:49 +1100
Re: awesome slugify and unicode Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-23 13:18 +0000
csiph-web