zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@sunsite.dk
Subject: Re: Little problem while converting from bash (quoting/splitting?)
Date: Sun, 15 May 2005 18:48:25 +0000	[thread overview]
Message-ID: <1050515184826.ZM25299@candle.brasslantern.com> (raw)
In-Reply-To: <20050515134623.M88380@2-0.pl>

On May 15,  4:48pm, krasnal wrote:
} Subject: Re: Little problem while converting from bash (quoting/splitting?
}
} On Thu, 12 May 2005 16:29:11 +0000, Bart Schaefer wrote
} > Bash apparently reads stdin/stdout pipes in text mode, whereas zsh 
} > does so in binary mode.
} 
} I understand the difference but I'm not sure I follow your arguments
} here :)).  Why reading in text mode would be problematic?

Suppose you have 7663 bytes of data containing 97 \r\n sequences.  You
don't know whether it's text or binary data.

Read it in text mode, where \r\n is automatically converted to \n, and
stuff the entire contents into a variable.  That variable will contain
only 7566 bytes.  Information has been lost.

Zsh is capable of dealing sensibly with non-text values stored in
variables, so it was deemed more appropriate to treat text as binary
(no information loss) than the other way around.  The exception for
reading files is made because the Cygwin platform supports filesystems
that force all reads and writes to be in text mode.  Zsh doesn't know
what kind of filesystem it's reading/writing for any given file, so the
only way to assure that all file reads and writes behave the same is
to treat them all as text, regardless of the filesystem type.

Once the data is in a pipe, though, all filesystem-enforced conversions
can be assumed already to have occured, so it's safer to treat the data
as binary, and not convert it any further.


  reply	other threads:[~2005-05-15 18:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-12  6:28 krasnal
     [not found] ` <krasnal@2-0.pl>
2005-05-12  9:39   ` Peter Stephenson
2005-05-15 13:35     ` krasnal
2005-05-12 16:29 ` Bart Schaefer
2005-05-15 13:48   ` krasnal
2005-05-15 18:48     ` Bart Schaefer [this message]
2005-05-19 13:17       ` krasnal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1050515184826.ZM25299@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).