Skip to content

make_ascii_lower/uppercase for Windows OsString? #69566

Closed
@TyPR124

Description

@TyPR124

The standard library seems to assume calling make_ascii_uppercase() on the underlying [u8] is safe on Windows, seen here:

impl From<OsString> for EnvKey {
fn from(k: OsString) -> Self {
let mut buf = k.into_inner().into_inner();
buf.make_ascii_uppercase();
EnvKey(FromInner::from_inner(FromInner::from_inner(buf)))
}
}

Would it be reasonable to add a make_ascii_uppercase() and/or make_ascii_lowercase() to Windows OsStrExt and/or OsStringExt to make this available to users of std?

Even if the internal representation of OsString changes down the road, I would assume the code above would still need to be replicated with the new representation, so it seems like it should be okay to have make_ascii_uppercase a stable/public API.

If this is a reasonable request, I am willing to make a PR with the appropriate methods implemented in the appropriate places.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.O-windowsOperating system: WindowsT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions