Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Displaying Windows line breaks in Putty

1,452 views
Skip to first unread message

Thomas Wiedmann

unread,
May 13, 2010, 10:50:24 AM5/13/10
to
Hello,

viewing text files containing Windows line breaks with vi on a UNIX system I
would expect, that Windows line breaks are displayed as ^M.
But Putty doesn't display ^M for Windows line breaks on my PC.

How has Putty to be configured, that Windows line breaks are displayed as ^M
in Putty?

Thomas Wiedmann

Adam H. Kerman

unread,
May 13, 2010, 2:34:15 PM5/13/10
to
Thomas Wiedmann <th...@gmx.de> wrote:

Text files have three different types of line boundaries:

Windows carriage return + line feed
Mac carriage return
Unix new line (same character as line feed)

When vi (perhaps you are really using vim?) shows ^M, that's not the entire
line boundary, just the carriage return character in the line boundary.

Are you checking for improper ascii file translation? Then just do a global
elimination of ^M in vi, which fixes the line boundary.

There are certainly text editors that will make line boundaries visible.
Don't know of one for Unix off the top of my head, and you're asking in
the wrong newsgroup. Ask in comp.editors.

This should not be a feature of the terminal emulation itself.

RedGrittyBrick

unread,
May 14, 2010, 6:26:07 AM5/14/10
to
On 13/05/2010 15:50, Thomas Wiedmann wrote:
> Hello,
>
> viewing text files containing Windows line breaks with vi on a UNIX
> system I would expect, that Windows line breaks are displayed as ^M.

It is vi that translates the carriage-return character into the two
characters caret and M.

If you use a LAN sniffer you'll see that vi transmits two characters
caret M not a single carriage-return character.

> But Putty doesn't display ^M for Windows line breaks on my PC.
>
> How has Putty to be configured, that Windows line breaks are displayed
> as ^M in Putty?

It isn't a job for Putty. Here's some Putty output cut & pasted on my
Windows PC:

$ cat test.txt
aaa
bbb
ccc
$ cat -v test.txt
aaa^M
bbb^M
ccc

What characters get sent to Putty depends both on the Unix/Linux program
being used (e.g. vi) and also on the stty settings. look at `man stty`
and the entries for ocrnl onlcr etc.

As far as I know, there's nothing in any ANSI, Xterm or VTxxx
specification to say that a terminal should normally display a caret and
an M when it receives a carriage-return character.

--
RGB

Keith F. Lynch

unread,
May 26, 2010, 9:00:08 PM5/26/10
to
Adam H. Kerman <a...@chinet.com> wrote:
> Text files have three different types of line boundaries:
> Windows carriage return + line feed
> Mac carriage return
> Unix new line (same character as line feed)

Hasn't Mac switched to the Unix convention now that the Max OS is just
a candy-colored shell on top of Unix?
--
Keith F. Lynch - http://keithlynch.net/
Please see http://keithlynch.net/email.html before emailing me.

Thomas Wiedmann

unread,
May 28, 2010, 2:16:56 AM5/28/10
to
> Hasn't Mac switched to the Unix convention now that the Max OS is just
> a candy-colored shell on top of Unix?

I'm not working with a Mac.

Thomas Wiedmann

--- news://freenews.netfront.net/ - complaints: ne...@netfront.net ---

Adam H. Kerman

unread,
May 28, 2010, 4:05:02 AM5/28/10
to
Keith F. Lynch <k...@KeithLynch.net> wrote:
>Adam H. Kerman <a...@chinet.com> wrote:

>>Text files have three different types of line boundaries:
>>Windows carriage return + line feed
>>Mac carriage return
>>Unix new line (same character as line feed)

>Hasn't Mac switched to the Unix convention now that the Max OS is just
>a candy-colored shell on top of Unix?

I didn't know that, not being a Mac user.

The carriage return line boundary applies through OS 9 only.

0 new messages