consoleconsole-applicationfreepascaldiacriticscodepages

Diacritics in a Free Pascal console application?


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

Is there a way how to force the console (cmd.exe on Windows 7) to use some specific encoding? Or at least where can I find which encoding does my console use?


Solution

  • To display the current codepage in cmd.exe:

    chcp
    

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

    chcp 1250