Does anyone aware of C# API to accept Language-Culture and return corresponding Code Page? For instance, if I call
MagicClass.GetCodePage("ru-RU")
I would get
1251
If this was answered before, please drop me a link.
Thanks in advance.
The TextInfo
class (accessible via CultureInfo.TextInfo
) contains code pages:
CultureInfo cultureInfo = CultureInfo.GetCultureInfo("ru-RU");
Console.WriteLine(cultureInfo.TextInfo.ANSICodePage); // 1251
It sounds like you want ANSI code pages, but you can also get Mac, OEM, and EBCDIC versions.
new CultureInfo("ru-Ru").TextInfo.ANSICodePage
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With