Методи вирішення проблем роботи з кирилицею у консольних с-програмах

Вантажиться...
Ескіз
Файли
Дата
2018
Автори
Радельчук, Г.І.
Radelchuk, G.I.
Назва журналу
Номер ISSN
Назва тому
Видавець
Хмельницький національний університет
Анотація
В статті проведено комплексне дослідження методів вирішення проблем, які виникають під час опрацювання україномовного тексту у консольних С-програмах. Встановлено, що причиною цих проблем є різні кодові сторінки, які використовуються у середовищах розробки і виконання програм. Розглянуто два підходи до вирішення цих проблем – забезпечення перетворення кодування символів до середовища виконання або зміна кодової сторінки у консольному вікні. На основі проведеного дослідження сформовано рекомендації щодо використання запропонованих засобів для різних версій Microsoft Visual Studio.
The purpose of the article is to study, analyze and systematize methods of solution to the problems with the Ukrainian-language text in console C-programs. The article provides a comprehensive study of methods for solution to the problems that occur during input, output and processing of the Ukrainian-language text in console C-programs, oriented on the development of Microsoft Visual Studio environment in different versions. It is found that the causes of these problems are different code pages used in the development environment (Microsoft Visual Studio) and the program execution environment (console) – 1251 and 866, respectively. Two approaches to the solution to these problems are considered – ensuring the conversion of character encoding to the execution environment, or the change of the code page in the runtime environment (console window). With the first approach, you can save the C-program file in the 866 encoding, which is not expedient. In the second approach, the possibilities of the programming language C and the Windows operating system are analyzed resulting in the suggestion of the means for ensuring the correct elaboration of the Ukrainian-language text: the standard function of the language C – setlocale(); functions WinAPI – SetConsoleCP() and SetConsoleOutputCP(); the system chcp command and the system() function. The mechanisms of the influence of these functions on the input/output streams are described, their advantages and disadvantages are identified, analyzed and experimentally confirmed. The presentation of the material is accompanied by fragments of program codes. On the basis of the study, recommendations for the use of the proposed tools in console C-programs for various versions of the Microsoft Visual Studio development environment were generated.
Опис
Ключові слова
консоль, консольна програма, мова програмування С, середовище розробки, кодова сторінка, локалізація, перекодування, console, console program, programming language C, development environment, code page, localization, transcoding
Бібліографічний опис
Радельчук, Г.І. Методи вирішення проблем роботи з кирилицею у консольних С-програмах [Текст] / Г. І. Радельчук // Вісник Хмельницького національного університету. Технічні науки. – 2018. – № 1. – С. 54-60.