Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29103
| Date | 2012-09-13 21:34 -0500 |
|---|---|
| From | Tim Chase <python.list@tim.thechases.com> |
| Subject | Re: Least-lossy string.encode to us-ascii? |
| References | <50524F6F.6070604@tim.thechases.com> <k2tqne$gie$1@ger.gmane.org> <mailman.654.1347580392.27098.python-list@python.org> <8a35c480-7594-4202-afe8-f03db9418301@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.660.1347590022.27098.python-list@python.org> (permalink) |
On 09/13/12 21:09, Mark Tolonen wrote:
> On Thursday, September 13, 2012 4:53:13 PM UTC-7, Tim Chase wrote:
>> Vlastimil's solution kept the characters but stripped them of their
>> accents/tildes/cedillas/etc, doing just what I wanted, all using the
>> stdlib. Hard to do better than that :-)
>
> How about using UTF-7 for transmission and decode on the other end? This keeps the transmission all 7-bit, and no loss.
>
> >>> s=u"serviço móvil".encode('utf-7')
> >>> print s
> servi+AOc-o m+APM-vil
> >>> print s.decode('utf-7')
> serviço móvil
Nice if I control both ends of the pipe. Unfortunately, I only
control what goes in, and I want it to be as un-screw-uppable as
possible when it comes out the other end (may be web, CSV files,
PDFs, FTP'ed file dumps, spreadsheets, word-processing documents,
etc), and us-ascii is the lowest-common-denominator of
unscrewuppableness while requiring nothing of the the other end. :-)
-tkc
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Least-lossy string.encode to us-ascii? Tim Chase <python.list@tim.thechases.com> - 2012-09-13 18:54 -0500
Re: Least-lossy string.encode to us-ascii? Mark Tolonen <metolone@gmail.com> - 2012-09-13 19:09 -0700
Re: Least-lossy string.encode to us-ascii? Tim Chase <python.list@tim.thechases.com> - 2012-09-13 21:34 -0500
Re: Least-lossy string.encode to us-ascii? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-14 04:05 +0000
Re: Least-lossy string.encode to us-ascii? Terry Reedy <tjreedy@udel.edu> - 2012-09-14 16:57 -0400
Re: Least-lossy string.encode to us-ascii? Mark Tolonen <metolone@gmail.com> - 2012-09-13 19:09 -0700
csiph-web