[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Windows Emacs shell/shell fail to execute ack perl script(locale err
From: |
Oleksandr Gavenko |
Subject: |
Re: Windows Emacs shell/shell fail to execute ack perl script(locale error) |
Date: |
Sun, 13 Jan 2013 12:21:52 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
On 2013-01-11, Vin Che wrote:
> Typing this command on regular cmd.exe or cygwin termal gives me results as
> expected:
>
> $ ack hello
>
> (I have ack.bat that execute ack.pl in my PATH)
>
> However, when I run the same command from either shell or eshell in Emacs,
> it gives me this error:
>
>
> c:\Users\Martin>"C:\cygwin\bin\perl" /cygdrive/c/Users/Martin/Desktop/
> ack.pl hello
> perl: warning: Setting locale failed.
> perl: warning: Please check that your locale settings:
> LC_ALL = (unset),
> LANG = "ENU"
> are supported and installed on your system.
> perl: warning: Falling back to the standard locale ("C").
>
> I tried to fix it by SETENV both variable to en_US.UTF-8 but when I run it
> again, it gave me no result but froze.
Try:
(setenv "LC_ALL" "C")
(setenv "LANG" "C")
What is "ENU" locale ??
From:
http://perldoc.perl.org/perllocale.html
You may encounter the following warning message at Perl startup:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LC_ALL = "En_US",
LANG = (unset)
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
This means that your locale settings had LC_ALL set to "En_US" and LANG exists
but has no value. Perl tried to believe you but could not. Instead, Perl gave
up and fell back to the "C" locale, the default locale that is supposed to
work no matter what. This usually means your locale settings were wrong, they
mention locales your system has never heard of, or the locale installation in
your system has problems (for example, some system files are broken or
missing). There are quick and temporary fixes to these problems, as well as
more thorough and lasting fixes.
Another valuable answer:
http://stackoverflow.com/questions/2499794/how-can-i-fix-a-locale-warning-from-perl
For example I use such code:
(when (eq system-type 'windows-nt)
(ignore-errors
(require 'cygwin-mount)
(cygwin-mount-activate)
)
(add-hook 'find-file-hook 'follow-cygwin-symlink)
;; Workaround for Cygwin shell, when set 'CYGWIN=noglob'. By default
'shell-quote-argument'
;; quoted by double '\' chars this cause failure.
(defun shell-quote-argument (argument)
(concat "'" argument "'")
)
;; Workaround for Cygwin when 'shell-file-name' is 'bash'.
(setq null-device "/dev/null")
;; Use shell from Cygwin/MinGW.
(setq shell-file-name "bash")
(setenv "SHELL" "/bin/bash")
(modify-coding-system-alist 'process "bash" '(cp1251-unix . cp1251-unix))
)
;; I prefer EN man pages.
(when (memq system-type '(windows-nt cygwin))
(setq manual-program "LANG=C man")
)
in which I turn man into LANG=C... The trick work as I use "bash" command line
interpreter under Windows.
--
Best regards!