Code::Blocks Forums

User forums => Help => Topic started by: lucrol on May 24, 2025, 06:48:37 pm

Title: Wrong accentuation in the Windows Console
Post by: lucrol on May 24, 2025, 06:48:37 pm
Hello, I am a French user new to Code::Blocks.
I am simply translating "Hello World" to test accented characters, but I am encountering an error because the console on my PC (configured for fr-FR) is set to code page 850.
By checking the properties of the Windows console window launched by Code::Blocks during execution, I can confirm this.
(screenshot_1)
Even if I modify the console's code page definition in the Windows registry, Code::Blocks does not take it into account!
(screenshot_2)
However, if I open a Windows console outside of Code::Blocks and change the code page (e.g., 1252 for French fr-FR), it works.
(screenshot_3)
But I cannot find a way to add the command:
CHCP 1252 > null
as the first line in the console when launching the executable (Run).
Could we find a solution (perhaps i miss something) ?
Ideally, it would be great if a global setting allowed this action automatically.
Thank you for the quality of this IDE.
Best regards.
Title: Re: Wrong accentuation in the Windows Console
Post by: lin_lcs on May 25, 2025, 04:27:31 am
You can include the header file <cstdlib>, and in the main function, add the line system("chcp 1252") before calling std::cout.