From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27642 invoked by alias); 24 May 2017 10:05:06 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 27621 invoked by uid 89); 24 May 2017 10:05:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=3.8 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_THEBAT,LIKELY_SPAM_SUBJECT,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 spammy=German, german, ronald, Ronald X-HELO: forward1j.cmail.yandex.net Received: from forward1j.cmail.yandex.net (HELO forward1j.cmail.yandex.net) (5.255.227.19) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 24 May 2017 10:05:03 +0000 Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [77.88.29.85]) by forward1j.cmail.yandex.net (Yandex) with ESMTP id F0C112181F; Wed, 24 May 2017 13:05:03 +0300 (MSK) Received: from smtp2p.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp2p.mail.yandex.net (Yandex) with ESMTP id CA3F71A800B9; Wed, 24 May 2017 13:05:02 +0300 (MSK) Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id xk3nWXe0Yw-52V8NlSL; Wed, 24 May 2017 13:05:02 +0300 (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (Client certificate not present) Authentication-Results: smtp2p.mail.yandex.net; dkim=pass header.i=@yandex.ru X-Yandex-Suid-Status: 1 0,1 0 Received: from [192.168.1.10] (HELO daemon2.darkdragon.lan) by daemon2 (Office Mail Server 0.8.12 build 08053101) with SMTP; Wed, 24 May 2017 10:03:59 -0000 Date: Wed, 24 May 2017 10:05:00 -0000 From: Andrey Repin Reply-To: cygwin@cygwin.com Message-ID: <1221683706.20170524130359@yandex.ru> To: Ronald Fischer , cygwin@cygwin.com Subject: Re: Bug: grep behaves incorrectly under the locale C.UTF-8, if a file contains Umlaut characters In-Reply-To: <1495612367.2760331.986814392.79C77EB2@webmail.messagingengine.com> References: <1495612367.2760331.986814392.79C77EB2@webmail.messagingengine.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-05/txt/msg00379.txt.bz2 Greetings, Ronald Fischer! > I have a file X which contains ASCII text, but also in some lines German > umlaut characters. The file is classified as: > $ file X > X: ISO-8859 text, with CRLF line terminators > If I grep the file using, say, > $ grep . X >Y > (i.e. select every non-empty line and write the result to Y), this works > fine, if LANG is set to one of: UTF-8, C, C.de_DE, C.en_EN, en_EN, > de_DE. > However, if LANG is set to C.UTF-8, two things happen: > - grep classifies the file as binary file and produces the error message > "Binary file X matches" This is an intended behavior, upstream decision since mid-2015, I recall. > - Both the grepped lines (i.e. in our example the non-empty lines) AND > the error message end up in the standard output (i.e. in file Y). > IMO, there are several problems with this: > 1. It's hard to see, why an umlaut character makes the file X binary > under encoding C.UTF-8, but not under encoding UTF-8 or C.en_EN > 2. If grep classifies a file as binary, I think the desired behaviour > would be to NOT produce any output, unless the -a flag has been > supplied. > 3. If grep writes a message "Binary file ... matches", this message > should go to stderr, not stdout. The stdout is supposed to contain only > a subset of the input lines. > Ronald -- With best regards, Andrey Repin Wednesday, May 24, 2017 13:02:39 Sorry for my terrible english... -- 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