User forums > Help
C-files & DOS Cyrillic encoding
SuperSailorMoon:
Can I customise Code::Blocks somehow to source text saving (for example, .c file) in format OEM 866 (DOS Cyrillic)? Otherwise non-Latin characters are displayed incorrectly in console applications.
OEM 866 is absent in Default encoding when opening files: list. Perhaps, is it possible to add this encoding somehow?
Biplab:
If C::B can display it properly, it indicates that the file is saved properly. But while compiling, the compiler is getting confused.
Try adding -finput-charset=CP1251 command to compiler options. :)
SuperSailorMoon:
The file, used in the picture above, is saved in Windows 1251 format. If it is saved as OEM 866, the text in editor window is displayed incorrectly, however the compiled program displays this text correctly.
How to make WYSIWYG?
SuperSailorMoon:
I have solved this problem!
1. It is necessary to change default font for console applications. That is, to change standard dot font to vector font, such as Consolas or Lucida Console. Take advantage of this .reg file:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console]
"ScreenColors"=dword:0000000f
"FontSize"=dword:00100000
"FontFamily"=dword:00000036
"FontWeight"=dword:000002bc
"FaceName"="Consolas"
for Consolas, or this:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console]
"FontSize"=dword:000e0000
"FontWeight"=dword:00000190
"FaceName"="Lucida Console"
"FontFamily"=dword:00000036
"ScreenColors"=dword:0000000f
for Lucida Console.
2. It is necessary to add following lines in a program code:
#include <Windows.h>
and
SetConsoleOutputCP (1251);
ivucica:
--- Quote from: SuperSailorMoon on January 02, 2008, 04:25:21 pm ---I have solved this problem!
<snip>
--- End quote ---
Seems more like an ugly hack than a problem solution to me. An end user will not be willing to do the registry hack that you're doing, and it's probably much easier to add a new CP to C::B's editor than to convince users to replace their default font. (We may like it, but the end users won't. And they'll like automatization even less.)
Regarding GNU/Linux machines, I don't know about their Cyrillic configuration (I didn't even fix it up for my Croatian == Central European glyphs), but it doesn't sound to me like most people will adapt their OS installation to suit their programs. If the distributions use CP 866, then coding for such distros is a bit harder with C::B.
Ok, I'll stfu. :)
Navigation
[0] Message Index
[#] Next page
Go to full version