2

I need to be able to ouput german symbols onto the console with, which will have to read from a txt file. currenty, whenever i try and use a batch file to output ä for exmpale, it returns o with a ~ over it. What do i need to do?

Thanks in advance

EDIT: i have tried using chcp 1252 and it doesn't seem to change anything, it still returns the same character as mentioned above

user2035296
  • 157
  • 1
  • 3
  • 8
  • What do you use for output (echo/type ...), what do you see with the type command, eg. `type file.txt` (Umlaute?) & what codepage is installed by default (`chcp` without arguments). – Endoro Mar 20 '13 at 21:36

2 Answers2

2

You may need to change your codepage. I just wrote a little batch file with just echo ä and got the same problem you mention. Added chcp 1252 and it echoed the correct character.

chcp 1252
echo ä

Got the idea from here: http://www.robvanderwoude.com/type.php#Unicode

Nate Hekman
  • 6,507
  • 27
  • 30
  • I tried this before asking, it doesn't seem to change anything after the chcp, the character still outputs the same way. – user2035296 Mar 20 '13 at 18:26
  • Sorry I can't help then, that fixes it for me. You should edit your question to indicate what you have tried. – Nate Hekman Mar 20 '13 at 19:15
  • 1
    Did you try the utf-8 codepage (`chcp 65001`)? And/or using the Lucida console fonts? See http://stackoverflow.com/questions/388490/unicode-characters-in-windows-command-line-how Nah, never mind, on reading deeper the comments say that switching to utf-8 "breaks batch files". – Nate Hekman Mar 20 '13 at 20:04
  • See jeb's answer--I was using notepad++ when I wrote my little experiment that works on my computer. – Nate Hekman Mar 20 '13 at 22:51
0

One way is to define the mutations/umlaute while code page 1252 is active and switch back to 850.

@echo off
chcp 1252 > nul
set ae=ä
set oe=ö
set ue=ü
set sz=ß
chcp 850 > nul
echo %ae% %oe% %ue% %sz%

Or you edit your batch file with an editor which supports code page 850 (like notepad++). Then you can insert directly the mutations.

jeb
  • 78,592
  • 17
  • 171
  • 225