delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/01/13/01:48:13

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <20100112145927.264380@gmx.net>
References: <20100112145927 DOT 264380 AT gmx DOT net>
Date: Wed, 13 Jan 2010 06:48:00 +0000
Message-ID: <416096c61001122248o6112e132l7e8be69eebf7ad7a@mail.gmail.com>
Subject: Re: How to print textfiles in Cygwin 1.7?
From: Andy Koppe <andy DOT koppe AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

2010/1/12 Niklaus Kuehnis:
> I've upgraded to Cygwin 1.7 (release version, clean install) and now am unable to print text files with non-ascii characters (i.e. German umlauts) from commandline.
>
> On Cygwin 1.5 printing used to work with a2ps but now all umlauts are replaced by strange characters (i.e. the u with diaeresis appears as a capital A with a tilde and '1/4'). The same happens with lpr. The files print fine using the Windows text editor.

The problem is that both a2ps and lpr don't yet support UTF-8.
Instead, they interpret the UTF-8 bytes as ISO-8859-1, which is why
umlauts, which are represented as two bytes in UTF-8, appear as two
funny characters.

a2ps has the -X option to tell it explicitly what encoding to use, but
unfortunately:

$ a2ps -X UTF-8
a2ps: unknown encoding `utf-8'

One workaround is to convert the file manually using iconv, e.g.:

$ iconv -f utf-8 -t iso-8859-1 bla.txt | a2ps -o bla.ps

(Of course this only works properly as long as your file doesn't have
any characters outside iso-8859-1.)


> I'm using mintty on Windows Vista Business and nano to produce the files. Files with umlauts are recognized as UTF-8 by the file command.

Please note that 'nano' also doesn't support UTF-8 yet. While entering
characters looks like it works initially, nano will internally think
that you've entered two characters when you enter an umlaut. Hence
things get wonky when you try to edit them.

Andy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019