diacritics in batch

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
doscode
Posts: 175
Joined: 15 Feb 2012 14:02

diacritics in batch

#1 Post by doscode » 01 Sep 2013 14:57

Can you help with this? I have a batch in Visual Studio which I need to compile programs. I found that the program cannot find path because it can not read correctly path. Folder in which it is placed is called "programování" but it sees as "programovßnÝ".

I tried to type in the correct PATH but it seems the same way.
Yet I tried to insert CP1250 (but has no effect)

http://paste.ofcode.org/348UKkJBFhVDLpQ4LGsRkMR

penpen
Expert
Posts: 1999
Joined: 23 Jun 2013 06:15
Location: Germany

Re: diacritics in batch

#2 Post by penpen » 01 Sep 2013 16:13

You may open a dos cmd shell, and do something like this for all lines that you need to convert to the desired codepage:

Code: Select all

Z:\>cmd /A
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

Z:\>(echo SET VS100COMNTOOLS=P:\programování\C++\Visual Studio 10.0\Common7\Tools\) > "testpath.bat"
Now just open the testpath.bat in notepad and copy paste it to wherever needed.

penpen

doscode
Posts: 175
Joined: 15 Feb 2012 14:02

Re: diacritics in batch

#3 Post by doscode » 02 Sep 2013 00:28

It results the same result. However I found mistake in my later command not CP1250 but CHCP 1250, that was a try to change it. My console displays the original script characters correctly, but the call command does not see them correctly.

If I would use the line

Code: Select all

SET VS100COMNTOOLS=P:\programování\C++\Visual Studio 10.0\Common7\Tools\

directly in the original script, that would not help anyway.

penpen
Expert
Posts: 1999
Joined: 23 Jun 2013 06:15
Location: Germany

Re: diacritics in batch

#4 Post by penpen » 02 Sep 2013 06:57

I have used the line, as it is the only line with programování in it, so i thought you wanted to use it.
You may use the transcoded name only if you need it somewhere else.

doscode wrote:If I would use the line

Code: Select all

SET VS100COMNTOOLS=P:\programování\C++\Visual Studio 10.0\Common7\Tools\
directly in the original script, that would not help anyway.
This is a hint, that you haven't done what i said above.
Then the line you get (using the default codepage 850) would be:

Code: Select all

SET VS100COMNTOOLS=P:\programov n¡\C++\Visual Studio 10.0\Common7\Tools\
According to which browser you are using you cannot copy and paste from this html code,
or maybe my browser didn't show the right string,
and additionally i cannot know what codepage you are using,
so i've given the way to get the right string.
You should use the codepage, you are using in your batch, so if you change the codepage there,
you have to do it again with the changed codepage, as this may lead to other results.

If i've misunderstood you with what you've written and you have used the changed codeline (with programov n¡), then i can't belive this:
doscode wrote:It results the same result.
It may not work, but it must be then another error.
(Tested the above using winxp home/prof, win7 home 32bit by creating a folder programování using the explorer,
and change to the path using a batch file written with notepad.)

Maybe you have changed the codepage inbetween then you must also change the text used in notepad:

Code: Select all

┌─────────────────────────┬──────────────┐
│ codepage :  DOS-Shell   │ notepad.exe  │
├─────────────────────────┼──────────────┤
│      850 : programování │ programov n¡ │
│     1250 : programovßnÝ │ programování │
└─────────────────────────┴──────────────┘
So using codepage 1250 prior to use the string programování in the batch should have helped, too.
(That using codepage 1250 doesn't help you above, sounds a little bit curious and make me wish to sit at your pc to test.
Maybe the path is used by MSVS somewhere else, too, and not only in this batch file;
for example when setting up the %include% pathes, or similar.)

If your system is using another character set than my system, you may list the directory
within the shell and redirect the output of this to a text file (using the codepage you want to use;
example is with default codepage 850) to be sure you are using the right diretcory name:

Code: Select all

Z:\>cmd /A
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

Z:\>dir * > "dir.txt"
The result in notepad.exe:

Code: Select all

 Datenträger in Laufwerk Z: ist Test
 Volumeseriennummer: 0438-EEA7

 Verzeichnis von z:\

02.09.2013  13:49    <DIR>          .
02.09.2013  13:49    <DIR>          ..
02.09.2013  13:22    <DIR>          programov n¡
               0 Datei(en)              0 Bytes
               3 Verzeichnis(se), 986.465.644.544 Bytes frei

penpen

Post Reply