unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Andrzej Skiba <andskiba@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: grep-find with Polish letters in Windows
Date: Tue, 14 Sep 2010 21:21:41 +0200	[thread overview]
Message-ID: <83r5gw2ksa.fsf@gnu.org> (raw)
In-Reply-To: <AANLkTikVQJgExbJTPSCLH04v8-Yt_XzmNDTpC6bLYY_r@mail.gmail.com>

> Date: Tue, 14 Sep 2010 13:02:30 +0200
> From: Andrzej Skiba <andskiba@gmail.com>
> 
> (defun as/grep-project (project pattern)
>   (interactive "sProject: \nsPattern: ")
>     (grep-find (concat
>                    "/usr/bin/find /cygdrive/c/projects/"
>                    project
>                    " -type f "
>                    " -not -name \"*.svn-base\" "
>                    "-and -not -name \"*.tmp\" "
>                    "-and -not -name \"*.log\" -print0 "
>                    "| xargs -0 -e grep -U -n -s -F \""
>                    pattern
>                    "\"")))
> 
> All works great until I try to search for a word with Polish letters (such
> as ą, ś, ć, ł, ń etc.). The files are all utf-8. When I run the command
> searching for string "Usuń" in project test I get the following output in
> the grep buffer:
> 
> /usr/bin/find /cygdrive/c/projects/test -type f -not -name "*.svn-base" -and
> -not -name "*.tmp" -and -not -name "*.log" -print0 | xargs -0 -e grep -U -n
> -s -F "Usuń"
> /usr/bin/bash: /usr/bin/find /cygdrive/c/projects/test -type f -not -name
> "*.svn-base" -and -not -name "*.tmp" -and -not -name "*.log" -print0 | xargs
> -0 -e grep -U -n -s -F "Usuń": No such file or directory
> 
> It runs fine with any input without Polish characters.

You seem to be using the native build of Emacs in conjunction with
Cygwin tools (Grep, Bash, etc.).  If so, this is asking for trouble,
because there are subtle incompatibilities between Cygwin programs and
native Windows programs.  I/O encoding is one of these areas: whereas
latest Cygwin versions use UTF-8, native Windows programs use the
current Windows codepage.  The native build of Emacs cannot encode
command lines it passes to programs in anything but the current
codepage, which is no good for you if your files are encoded in UTF-8.

I suggest to use the Cygwin build of Emacs instead.

> The find command works fine in a regular window shell as well as cygwin
> bash.

What is the "regular window shell"?  If it's CMD, then I don't see how
it could work, since CMD does not support UTF-8 keyboard input.
Perhaps the Cygwin port of Grep transparently converts keyboard input
into UTF-8 or something.




  reply	other threads:[~2010-09-14 19:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-14 11:02 grep-find with Polish letters in Windows Andrzej Skiba
2010-09-14 19:21 ` Eli Zaretskii [this message]
2010-09-15  7:32   ` Andrzej Skiba

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=83r5gw2ksa.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=andskiba@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).