This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Internal echo of shell beaves (sometimes) different to external echo
On Jul 20 07:08, Ralf wrote:
> Cyrille Lefevre <cyrille.lefevre-lists <at> laposte.net> writes:
>
> >
> > Le 19/07/2012 16:51, Ralf a Ãcrit :
> > > Is there a way to get the right umlaut with the internal echo of the shell?
> > > Example script:
> > >
> > > export LC_ALL=de_DE
> >
> > seems to default to iso8859-1 or something like that, let's try
> >
> > export LC_ALL=de_DE.UTF-8
> >
> > which should work better...
> >
>
> export LC_ALL=de_DE.UTF-8 gives following output:
>
> C:\>bash ttt.sh
> CYGWIN_NT-6.0-WOW64 WIESWEG 1.7.15(0.260/5/3) 2012-05-09 10:25 i686 Cygwin
> Râcken
> 0000000 R 374 c k e n \r \n
> 0000010
> Râcken
> 0000000 R 374 c k e n \n
> 0000007
> Râcken
> 0000000 R 374 c k e n \n
> 0000007
What you don't seem to see is that the codeset doesn't play any role
anymore *at this point in time*. You already created the string
"RÃcken" in ISO-8859-1 at the time you created the script and your
script will diligently create the file ttt.txt with the word RÃcken in
ISO-8859-1, because that's how it's stored in the script. Thus, it
doesn't matter what codeset you have set when running that script.
Here's an idea for you to test:
Replace
echo "RÃcken" > ttt.txt
with
read -p "Enter: " foo
echo "$foo" > ttt.txt
And then start your script with LANG set to, for instance, C.UTF-8, as is
the default when running an interactive Cygwin shell like bash or tcsh.
(though I would prefer to use POSIX paths rather than DOS paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames)
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
--
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