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


Groups > comp.lang.python > #31029

Re: mangled messages

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python.list@tim.thechases.com>
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; 'removes': 0.05; 'subject:messages': 0.09; 'cc:addr:python-list': 0.10; '(lf)': 0.16; '-tkc': 0.16; 'disk.': 0.16; 'file;': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'message- id:@tim.thechases.com': 0.16; 'newlines': 0.16; 'received:70.251': 0.16; 'received:dsl.rcsntx.swbell.net': 0.16; 'received:rcsntx.swbell.net': 0.16; 'received:swbell.net': 0.16; 'reliably': 0.16; 'robust.': 0.16; 'spurious': 0.16; 'this)': 0.16; 'unix-style': 0.16; 'wrote:': 0.17; 'tim': 0.18; 'written': 0.20; 'tells': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'leave': 0.26; '[1]': 0.27; '(3)': 0.27; 'dos': 0.27; "doesn't": 0.28; 'lines': 0.28; 'chase': 0.29; 'thinks': 0.29; 'writes:': 0.29; 'writes': 0.30; 'file': 0.32; '(2)': 0.32; 'problem': 0.33; 'that,': 0.34; '(1)': 0.34; 'there': 0.35; 'should': 0.36; 'does': 0.37; 'quite': 0.37; 'subject:: ': 0.38; 'shows': 0.38; 'where': 0.40; 'end': 0.40; 'your': 0.60; 'easy': 0.60; 'remove': 0.61; 'back': 0.62; 'sound': 0.65; '(they': 0.84; 'received:50.22': 0.84
Date Tue, 09 Oct 2012 09:26:15 -0500
From Tim Chase <python.list@tim.thechases.com>
User-Agent Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111120 Icedove/3.1.16
MIME-Version 1.0
To Jussi Piitulainen <jpiitula@ling.helsinki.fi>
Subject Re: mangled messages
X-Priority 4 (Low)
References <801f0e2c-7d1d-4e91-bec5-78c5e53a70ec@googlegroups.com> <mailman.1973.1349736270.27098.python-list@python.org> <adht95F2luqU1@mid.individual.net> <mailman.1982.1349764176.27098.python-list@python.org> <qotr4p8cdot.fsf@ruuvi.it.helsinki.fi> <mailman.1987.1349780698.27098.python-list@python.org> <qotpq4r7svd.fsf@ruuvi.it.helsinki.fi>
In-Reply-To <qotpq4r7svd.fsf@ruuvi.it.helsinki.fi>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - boston.accountservergroup.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - tim.thechases.com
X-Source
X-Source-Args
X-Source-Dir
Cc python-list@python.org
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2000.1349792713.27098.python-list@python.org> (permalink)
Lines 32
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1349792713 news.xs4all.nl 6964 [2001:888:2000:d::a6]:51078
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:31029

Show key headers only | View raw


On 10/09/12 07:05, Jussi Piitulainen wrote:
> Tim Chase writes:
>> However, it might be that there is no CR+LF on the last line,
>> or that one line is missing the CR, so your viewer heuristic
>> (vim does this) thinks it has Unix NL-only line-endings and
>> shows the ^M on all the lines that have the CR.  All for one
>> stray line without.
> 
> That doesn't sound robust. The problem is still quite rare for
> me.

Vim's heuristic is that, if *all* the lines end in CR+LF, it's a
DOS-formatted file; otherwise it's a Unix-style (LF) file with
spurious CRs in it (they just happen to come at the end of
most-but-not-all lines).  It works quite robustly, since writing the
file back out will reliably put the CRs back where they were and
leave the non-CR'ed lines as they were with only LF.  Vim makes it
pretty easy to remove the spurious CRs and then change the
file-format from Unix to DOS line-endings and write it out if that's
what you want[1].

-tkc


[1]
:%s/\r$
:set ff=dos
:w

which (1) removes the spurious/inconsistent CRs, (2) tells vim that
newlines should be written as CR+LF when writing and (3) writes the
file back out to disk.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Unpaking Tuple sajuptpm <sajuptpm@gmail.com> - 2012-10-06 03:09 -0700
  Re: Unpaking Tuple Chris Rebert <clp2@rebertia.com> - 2012-10-06 03:27 -0700
    Re: Unpaking Tuple Roy Smith <roy@panix.com> - 2012-10-06 08:46 -0400
      Re: Unpaking Tuple Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-06 15:08 +0000
        Re: Unpaking Tuple Thomas Bach <thbach@students.uni-mainz.de> - 2012-10-08 23:45 +0200
        RE: Unpaking Tuple "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-10-08 22:21 +0000
          Re: RE: Unpaking Tuple Bob Martin <bob.martin@excite.com> - 2012-10-09 07:07 +0100
            Re: Unpaking Tuple Dave Angel <d@davea.name> - 2012-10-09 02:29 -0400
              Re: Unpaking Tuple Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2012-10-09 10:22 +0300
                Re: mangled messages (was: Unpaking Tuple) Tim Chase <python.list@tim.thechases.com> - 2012-10-09 05:48 -0500
                Re: mangled messages (was: Unpaking Tuple) Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2012-10-09 15:05 +0300
                Re: mangled messages Tim Chase <python.list@tim.thechases.com> - 2012-10-09 09:26 -0500
            Re: Unpaking Tuple Grant Edwards <invalid@invalid.invalid> - 2012-10-09 14:11 +0000
            RE: RE: Unpaking Tuple "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-10-09 16:40 +0000
            Re: Unpaking Tuple Robert Miles <robertmiles@teranews.com> - 2012-11-18 19:14 -0600
            Re: Unpaking Tuple Hans Mulder <hansmu@xs4all.nl> - 2012-11-19 02:56 +0100
  Re: Unpaking Tuple woooee <woooee@gmail.com> - 2012-10-07 10:58 -0700
    Re: Unpaking Tuple Terry Reedy <tjreedy@udel.edu> - 2012-10-07 16:03 -0400

csiph-web