Skip to content

Instantly share code, notes, and snippets.

@nullstalgia
Created January 3, 2025 05:49
Show Gist options
  • Save nullstalgia/923e00cab3853f98973168b4650d9f00 to your computer and use it in GitHub Desktop.
Save nullstalgia/923e00cab3853f98973168b4650d9f00 to your computer and use it in GitHub Desktop.
windows-sys GetACP Example
[package]
name = "getacp-example"
version = "0.1.0"
edition = "2021"
[dependencies]
codepage = "0.1.2"
[dependencies.windows-sys]
version = "0.59"
features = ["Win32_Foundation", "Win32_Globalization"]
use windows_sys::Win32::Globalization::GetACP;
fn main() {
let acp = unsafe { GetACP() } as u16;
println!("ACP: {acp}");
let encoding = codepage::to_encoding(acp).unwrap();
println!("{encoding:?}")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment