rust-lang / rust-lang/rfcs

Revisiting OsStr and UTF-8 on Windows

Open
#2,741 6 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-ffi A-string A-windows
Dominant language
Markdown
Stars
6.6k
Forks
1.7k
Avg merge
16h 14m
Merged PRs (30d)
1

Description

As of Windows 10 build 17035 (stabilized in April 2018 update), all (in reality, most) Windows APIs can be called via the "legacy" narrow-string interfaces (e.g. CreateFileA instead of CreateFileW), but have been updated to be UTF-8 compatible when the codepage is set to UTF-8 (rather than expecting CP-1252 or the non-unicode system character set). It also affects non-suffixed functions like fopen.

I haven't dug in deeply enough to see what the behavior is when the original data is not valid Unicode (e.g. how this intersects with WTF-8), but it does provide some opportunities to unify the behavior between unix and Windows ffi, e.g. using u8 rather than u16 for OsStrExt.

Of course none of this going to be backported to older versions of Windows we would like to continue supporting, so I'm not sure how that would ultimately play with cfg targets, either.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by investigating Rust's OsStrExt behavior and the Windows narrow-string APIs described in the issue, including invalid Unicode and supported Windows versions. Determine how the proposal would interact with WTF-8 and cfg targets; done requires a settled, implementable approach for unifying Unix and Windows FFI behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.