When I output/echo some text with special chars like german Umlaute or french accents at the console then the chars are not written correctly onto the console.
Writing them into a file works with the command:
chcp 1252
...but this does not help for console.
Is there a similar command here as well?
I found the command line switch
cmd.exe /U
but that means I have to call at first an initail base cmd.exe and then open another console with cmd /U.
This is unhandy.
Is there a way to ALWAYS automatically start cmd.exe with the /U flag?
No, I don't want to use shortcuts to cmd.exe.
This does not help when I start *.bat batch files.
I guess I have to fix this in Registry: But how?
Any other work around for 64bit AND 32bit Win7?
Is there a disadvantage when using always /U flag?
Thank you
Peter
Output of umlaute chars at the console? Auto-set flag "/U" ?
Moderator: DosItHelp
Re: Output of umlaute chars at the console? Auto-set flag "/
You don't give enough details to tell for sure, but most likely all you need is to set the console to a TT font like Lucida Console instead of the default raster font.pstein wrote:When I output/echo some text with special chars like german Umlaute or french accents at the console then the chars are not written correctly onto the console.
Writing them into a file works with the command:
chcp 1252
...but this does not help for console.
The /u switch does not affect the output displayed in the console, just the piped or redirected output.pstein wrote:I found the command line switch
cmd.exe /U
Per-batch file console properties (including font) are remembered under HKCU_Console.pstein wrote:No, I don't want to use shortcuts to cmd.exe.
This does not help when I start *.bat batch files.
I guess I have to fix this in Registry: But how?
Liviu
Re: Output of umlaute chars at the console? Auto-set flag "/
Liviu wrote:Per-batch file console properties (including font) are remembered under HKCU_Console.
Liviu
Thank you.
But when I go (on 64bit Win7) to
HKCU_Console
as you suggested then ethere are NO specialized properties for any batch file
(although I dozends of them).
So where else can I setup e.g. that batch file aaa.bar should have 10 rows and 50 columns (instead of the default 50 rows + 100 columns)?
Re: Output of umlaute chars at the console? Auto-set flag "/
pstein wrote:But when I go (on 64bit Win7) to
HKCU_Console
as you suggested then ethere are NO specialized properties for any batch file
(although I dozends of them).
So where else can I setup e.g. that batch file aaa.bar should have 10 rows and 50 columns (instead of the default 50 rows + 100 columns)?
Can you search the registry for a unique batch file name? Maybe the location has changed in 64 bit windows.
Re: Output of umlaute chars at the console? Auto-set flag "/
@pstein
Your name sounds German. I assume the editor you use saves the code in code page 1252. That means if you save the Umlaut ö then it is represented as 11110110 (hex 0xF6) in the file. See http://en.wikipedia.org/wiki/Windows-1252
Cmd.exe parses the file in code page 850 with German settings. 0xF6 is now interpreted as character ÷ as you can see here: http://en.wikipedia.org/wiki/Code_page_850
The simpliest way is to save the batch file encoded in cp850 (some editors support it). Another possible way is to use variables, eg.
Regards
aGerman
Your name sounds German. I assume the editor you use saves the code in code page 1252. That means if you save the Umlaut ö then it is represented as 11110110 (hex 0xF6) in the file. See http://en.wikipedia.org/wiki/Windows-1252
Cmd.exe parses the file in code page 850 with German settings. 0xF6 is now interpreted as character ÷ as you can see here: http://en.wikipedia.org/wiki/Code_page_850
The simpliest way is to save the batch file encoded in cp850 (some editors support it). Another possible way is to use variables, eg.
Code: Select all
@echo off &setlocal
setlocal&for /f "tokens=2 delims=:" %%a in ('chcp') do (set /a oemcp=%%~na&chcp 1252>nul)
for /f "tokens=1-7" %%a in ('echo Ä Ö Ü ä ö ü ß^&chcp %oemcp%^>nul') do (
set au=%%a&set ou=%%b&set uu=%%c&set al=%%d&set ol=%%e&set ul=%%f&set sz=%%g)
(endlocal&set Ä=%au%&set Ö=%ou%&set Ü=%uu%&set ä=%al%&set ö=%ol%&set ü=%ul%&set ß=%sz%)
echo German example:
echo %Ä%nderungen der Ma%ß%einheiten f%ü%hren m%ö%glicherweise zu
echo verf%ä%lschten Ergebnissen in der %Ü%bertragsgleichnung.
echo(
pause
Regards
aGerman
Re: Output of umlaute chars at the console? Auto-set flag "/
aGerman wrote:@pstein
I assume the editor you use saves the code in code page 1252. That means if you save the Umlaut ö then it is represented as 11110110 (hex 0xF6) in the file. See http://en.wikipedia.org/wiki/Windows-1252
Cmd.exe parses the file in code page 850 with German settings. 0xF6 is now interpreted as character ÷ as you can see here:
The simpliest way is to save the batch file encoded in cp850 (some editors support it).
@aGerman:
Hmm, file storage is not the problem.
I am using (from batch file) a program which in turn decides to use a codepage independently of the user.
I have no choice which code page it uses.
Ok, an example: Have a look at the well know, very good, free cmdline program XXCOPY (not XCOPY) from here:
http://www.xxcopy.com/xcpydnld.htm
It reads e.g. during /CLONE or COPY operation filenames as "Änderung Überspannschutz.doc" from hard disc but displays messed filenames onto cmdprompt log output.
How can I avoid this?
Peter