Intel® Fortran Compiler 18.0 Developer Guide and Reference

NLSSetLocale (W*S)

NLS Function: Sets the current language, country, or codepage.

Module

USE IFNLS

result = NLSSetLocale (language[,country] [,codepage])

language

(Input) Character*(*). One of the languages supported by the Windows* NLS APIs.

country

(Input; optional) Character*(*). If specified, characterizes the language further. If omitted, the default country for the language is set.

codepage

(Input; optional) INTEGER(4). If specified, codepage to use for all character-oriented NLS functions. Can be any valid supported codepage or one of the following predefined values defined in IFNLS.F90:

  • NLS$CurrentCodepage - The codepage is not changed. Only the language and country settings are altered by the function.

  • NLS$ConsoleEnvironmentCodepage - The codepage is changed to the default environment codepage currently in effect for console programs.

  • NLS$ConsoleLanguageCodepage - The codepage is changed to the default console codepage for the language and country combination specified.

  • NLS$WindowsEnvironmentCodepage - The codepage is changed to the default environment codepage currently in effect for Windows programs.

  • NLS$WindowsLanguageCodepage - The codepage is changed to the default Windows codepage for the language and country combination specified.

If you omit codepage, it defaults to NLS$WindowsLanguageCodepage. At program startup, NLS$WindowsEnvironmentCodepage is used to set the codepage.

Results

The result type is INTEGER(4). The result is zero if successful. Otherwise, one of the following error codes (defined in IFNLS.F90) may be returned:

NOTE

NLSSetLocale works on installed locales only. Many locales are supported, but they must be installed through the system Control Panel/International menu.

When doing mixed-language programming with Fortran and C, calling NLSSetLocale with a codepage other than the default environment Windows codepage causes the codepage in the C run-time library to change by calling C's setmbcp( ) routine with the new codepage. Conversely, changing the C run-time library codepage does not change the codepage in the Fortran NLS library.

Calling NLSSetLocale has no effect on the locale used by C programs. The locale set with C's setlocale( ) routine is independent of NLSSetLocale.

Calling NLSSetLocale with the default environment console codepage, NLS$ConsoleEnvironmentCodepage, causes an implicit call to the Windows API SetFileApisToOEM( ). Calling NLSSetLocale with any other codepage causes a call to SetFileApisToANSI( ).

See Also