Skip to content

Execution character set on Windows - add execution_windows_acp and execution_windows_ocp? #45

@eternaleye

Description

@eternaleye

On Windows, the question of "execution character set" (at least for narrow characters) is complicated by some additional factors:

  1. There are two execution character sets in play at runtime:
    • the OEM Code Page (CP_OCP), as is used for the console
    • the ANSI Code Page (CP_ACP), as is used for the GUI
  2. The behavior of the mbrto* and *tombr functions is, at least according to the documentation, inconsistent:
    • mbrtowc is documented as treating its input as the "current locale" (and you can play games with the .ACP and .OCP locales, accordingly)
    • mbrtoc32, on the other hand, is documented as treating its input as UTF-8 unconditionally.

As a result, I'm not sure that there is currently any way that ztd.text currently handles the "execution character set" on Windows that provides the expected result under all circumstances:

I haven't verified at runtime that (2) actually presents itself, partly because while this documentation is for Visual Studio I'm using Embarcadero C++ Builder (and their standard library is sorely underdocumented and variable by version), and partly because issue (1) is the more pressing (the application I'm working with needs to interact with both, as we're currently in the midst of making it UTF-8 native, but need to retain the ability to interact with legacy files that were due to oversights written according to CP_ACP, and also need to emit data to the console in certain circumstances).

As a result, is there any chance that flavors of the execution character set could be added for CP_ACP and CP_OCP - or possibly for Windows CP_* values in general?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions