This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Umlauts on commandline and in .bat files


Consider this program, printing the commandline arguments char by char
in octal:

    #include <stdio.h>
    int
    main(int argc, char *argv[])
    {
	int i;
	unsigned char *p;
	for (i=1; i < argc; i++) {
	    p = argv[i];
	    while (*p) {
		printf("%03o ", *p++);
	    }
	    printf("\n");
	}
	return 0;
    }

Now in a .bat file, I have a commandline containing german Umlauts:
    $ cat ttt.bat
    ./t.exe "ÄÖÜäöüß"

Running this via `sh' yields the expected result:
    $ sh ttt.bat
    304 326 334 344 366 374 337

But running via the `.bat => cmd' binding
    $ ./ttt.bat

    h:\ralf\si++.4.0.C138>./t.exe "-Í_õ÷³¯"
    055 315 137 365 367 263 257

gives me some unexpected bytes.
However:
    $ cmd /c 'type ttt.bat | od -b'
    0000000 056 057 164 056 145 170 145 040 042 304 326 334 344 366 374 337
    0000020 042 012 012
is ok (the leading stuff is the command itself, the bytes are 304 326 ff).

What's even more confusing:
    $ cmd /c type ttt.bat
    ./t.exe "-Í_õ÷³¯"
show's me the `wrong' bytes 055 315 ...,
but 
    $ cmd /c type ttt.bat  | od -b
    0000000 056 057 164 056 145 170 145 040 042 304 326 334 344 366 374 337
    0000020 042 012 012
gives again the correct bytes.

What is it that I'm missing here?

It's obviously not an error in bash/cygwin, but I'd be very thankful
for any pointers to the underlying problem...

R', not a Doze-Expert :-/
--------------------
cygcheck:
WinNT Ver 4.0 build 1381 Service Pack 6
(german language version)
    Cygwin DLL version info:
        dll major: 1003
        dll minor: 1
        dll epoch: 19
        dll bad signal mask: 19005
        dll old termios: 5
        dll malloc env: 28
        api major: 0
        api minor: 38
        shared data: 3
        dll identifier: cygwin1
        mount registry: 2
        cygnus registry name: Cygnus Solutions
        cygwin registry name: Cygwin
        program options name: Program Options
        cygwin mount registry name: mounts v2
        cygdrive flags: cygdrive flags
        cygdrive prefix: cygdrive prefix
        cygdrive default prefix: 
        build date: Tue Apr 24 20:01:02 EDT 2001
        shared id: cygwin1S3


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]