Roy Tang

Programmer, engineer, scientist, critic, gamer, dreamer, and kid-at-heart.

Blog Notes Photos Links Archives About

Anyone have any idea how to get the value of “Language for Non-Unicode Programs” in Control Panel Regional Settings programmatically using c#?

Already tried CultureInfo, RegionInfo and getting the default encoding using the Encoding object, but I can only get the Standards and Formats value or the main code page.

Comments

IIRC, Thread.CurrentUICulture gets that value.

The NLS Terminology page in Internationalization for Windows Applications has the answer:

An ANSI application should check the language for non-Unicode programs setting during installation. It uses GetACP or GetOEMCP to retrieve the value. No function is supported to set the language for non-Unicode programs.

The GetACP function returns the “ANSI code page” (e.g. 1252 for english), while GetOEMCP returns the “OEM code page” (the code page used in the console, 437 for english).

Code Pages has more information about code pages in Windows.