Reputation: 1
How do I know what character encoding to save a batch file as?
I've heard that windows uses difrent charset for cmd and GUIs.
Upvotes: 0
Views: 3041
Reputation: 2638
I think the question has to do with localization, e.g., for echo messages in a .bat file. (and not line-endings or anything like that)
The question for me is then how can a .bat file control being treated as UTF-8 and not the local default code page. Is there a cue to cmd.exe that will get that to work?
In scripts built and used in an international setting, this matters.
Upvotes: 0
Reputation: 25449
You can use chcp to display and config the active code page.
Show chcp usage:
C:\> chcp /?
Show current code page:
C:\> chcp
Config active code page (example):
C:\> chcp 437
Upvotes: 0
Reputation: 5207
It depends on the character set implemented by cmd.
C:\Users\>chcp
Active code page: 437
Code page 437 is (I believe) the default for Windows systems. It uses ASCII encoding, and the following character set:
Upvotes: 1