문제

I print messages with diacritics in my console application. I tried to set multiple encoding commonly used for my language (CZECH) but non of them is giving me the desired result. I tried UTF-8, Windows(CP1250), ISO 8859-2...

Is there a way how to force console to use some specific encoding?

Or at least where can I find which encoding does my console use?

Thanks in advance.

EDIT: Using Windows 7 - basic command line console ( cmd.exe )

도움이 되었습니까?

해결책

To display the current codepage in cmd.exe:

chcp

To change the current codepage, e.g., to CP-1250:

chcp 1250

다른 팁

By default, the Windows console uses the OEM encoding. There are three encodings for APIs in Windows OEM, ANSI and Unicode. CMD.exe when normally executed uses OEM.

UTF8 seems to be possible, but needs

  1. starting the console with "cmd /u" (create a shortcut)
  2. setting the codepage to chcp 65001
  3. choosing a unicode capable font (e.g. Consolas 20) in the settings of the shortcut
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top