Skip to content

0.1.1: names reach the system as UTF-8, never through the code page - #4

Merged
Sunrisepeak merged 1 commit into
mainfrom
os-0.1.1-utf8
Oct 27, 2026
Merged

Sunrisepeak merged 1 commit into
mainfrom
os-0.1.1-utf8

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

On Windows (MSVC), path::generic_string() and path::string() narrow through the ANSI code page:

  • A name the code page cannot spell throws. Inside the library this ends the program at once (0xC0000409). openmui's tests hit this when they save a session or list endpoints under a non-ASCII directory.
  • A name the code page can spell reaches openkal-windows as ANSI bytes, but openkal reads names as UTF-8 (MultiByteToWideChar(CP_UTF8, …)), so the file opened is the wrong one.
  • path(std::string) repeats the mistake on the way back (environment values, link names, endpoint names).

This PR:

  • adds os::fs::utf8, generic_utf8 and from_utf8, and routes every name through them: the 40 sites in fs, process, env, dirs, ipc and the Windows module (README rule R7);
  • extends fs_test to write, read, replace and rename a file whose directory and name are in four scripts, and to check that an error names the file in UTF-8;
  • bumps the version to 0.1.1 (a patch: one additive API, no change in behaviour on POSIX).

It is based on main, so the open 0.2.0 branch (#3) can merge it forward.

path::generic_string() and path::string() narrow through the ANSI code page
on Windows (MSVC): a name the code page cannot spell throws, which ended a
program at once (0xC0000409), and a name it can spell reached openkal-windows
as ANSI bytes, while openkal reads names as UTF-8 (MultiByteToWideChar
CP_UTF8). path(std::string) made the same mistake on the way back.

os::fs::utf8, generic_utf8 and from_utf8 are the conversions, and every
name in fs, process, env, dirs, ipc and the Windows module goes through
them (README R7). fs_test writes, reads, replaces and renames a file
whose directory and name are in four scripts, and checks that an error
names the file in UTF-8.

Found by openmui's tests, which save and list files under non-ASCII names
on Windows.
@Sunrisepeak
Sunrisepeak merged commit aef149c into main Oct 27, 2026
12 checks passed
@Sunrisepeak
Sunrisepeak deleted the os-0.1.1-utf8 branch October 27, 2026 02:13
Sunrisepeak added a commit to mcpplibs/mcpp-index that referenced this pull request Oct 27, 2026
* mcpplibs.os 0.1.1: names reach the system as UTF-8, never through the code page

The patch release of mcpplibs/os#4. On Windows, 0.1.0 narrowed names through
the ANSI code page: a name it could not spell ended the program, and one it
could spell reached openkal (which reads UTF-8) wrongly. The tests/examples/os
consumer moves to 0.1.1 and writes and reads a file whose name is not ASCII.

* mcpplibs.os: automatic updates follow the repository's version tags
Sunrisepeak added a commit to Sunrisepeak/mui that referenced this pull request Oct 27, 2026
…te names

openmui's tests save sessions and list endpoints under non-ASCII names.
On Windows (MSVC) mcpplibs.os 0.1.0 narrowed those names through the ANSI
code page and ended the program (0xC0000409). os 0.1.1 (mcpplibs/os#4,
mcpp-index #580) passes names as UTF-8 throughout.

The viewer makes a name absolute before it reads it: on Windows `\docs`
is on the current drive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant