Archive: Talk:Windows-1252/Archive 1

Current usage of Windows-1252 in Windows

edit

There seems to be *no* usage of Windows-1252 in current Windows versions in the year 2024. According to microsoft now UTF-16/UTF-8 is used for applications.[1]

In Windows 10 with German locale I find: UTF-8 for MS Word and Windows editor, cp850 for DOS-Box and UTF-8 for Windows-Powershell. *No* Windows-1252.

What is your experience with codepages in Windows 10 and Windows 11?

U2718 (talk) 14:19, 27 July 2024 (UTC)Reply

Many functions such as `fopen()` take Windows-1252, and it still involves considerable effort to change this to UTF-8 (it used to be impossible). Spitzak (talk) 20:42, 27 July 2024 (UTC)Reply
Hmm, seems not so difficult.
FILE *fp = fopen("newfile.txt", "rt+, ccs=UTF-8");
https://learn.microsoft.com/de-de/cpp/c-runtime-library/reference/fopen-wfopen?view=msvc-170 U2718 (talk) 13:06, 28 July 2024 (UTC)Reply
That is not zero work, is not portable. What is needed is a way so UTF-8 works without any changes to the code, such as setting an environment variable before running the software. And then this setting must be the default, otherwise whatever encoding you get without any setting is the default. For Windows this still is cp1252. Spitzak (talk) 18:39, 28 July 2024 (UTC)Reply
So it is a migration problem for existing software in C or C++, it is required to change the call to fopen() and you have to handle UTF-16 strings as wchar_t in the program. U2718 (talk) 20:18, 28 July 2024 (UTC)Reply
CP1252 *IS* the default "ANSI code page" and that is referenced and influences the operation of lots of functions, such as fopen. It does not matter if there are optional arguments that can instruct them to use another encoding, or some other call that takes UTF-16. The code for fopen "uses" CP1252 by default. An example of something I would consider "not using CP1252" is if the default (ie when you reboot a newly installed Windows) "ANSI code page" was UTF-8 (or a variant that handles valid UTF-8 but "uses" CP1252 for error bytes). Spitzak (talk) 21:41, 28 July 2024 (UTC)Reply
I assume your experience is with C and C++. Do these problems also occur with C# and other .Net languages? U2718 (talk) 15:49, 29 July 2024 (UTC)Reply
If they can call the 8-bit Windows API and work with 8-bit strings, then certainly it does. Spitzak (talk) 22:43, 29 July 2024 (UTC)Reply

Alt key input

edit

In fact, this method enters characters from "ANSI" and "OEM" codepages associated with current keyboard language/layout, not just 1251 and 437. Thus switching keyboard between say Russian and Norwegian one can enter different sets of characters. -- 28 December 2006 Goldminer~enwiki

  1. ^ "Unicode and character sets". Microsoft. 2023-06-13. Retrieved 2024-05-27. New Windows applications should use Unicode