Created
January 3, 2025 05:49
-
-
Save nullstalgia/923e00cab3853f98973168b4650d9f00 to your computer and use it in GitHub Desktop.
windows-sys GetACP Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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