Roy Tang
Roy Tang

Reputation: 5761

Getting Language for Non-Unicode Programs

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.

Upvotes: 3

Views: 4203

Answers (3)

Nickolay
Nickolay

Reputation: 32063

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.

Upvotes: 1

Omer van Kloeten
Omer van Kloeten

Reputation: 11980

IIRC, Thread.CurrentUICulture gets that value.

Upvotes: 0

Related Questions