set_locale()
Set or get the value of a locale category.
Syntax
Parameter
Parameter | Definition |
---|---|
category | locale categories Use ALL if you want to assign the default value to all locale categories. To use ALL, thelocale parameter must be "". For an explanation of locale categories, see PATROL Script Language Reference Manual Volume 1--PSL Essentials. Valid Values |
locale | locale name Use "" to assign the default value to the locale category. Use 0 to return the current value of the locale category. Use a specific locale name to assign that name to the locale category. For an explanation of locale names, see PATROL Script Language Reference Manual Volume 1--PSL Essentials. Valid Values |
Description
The set_locale() function sets or gets the value of a locale category.
The value of the locale parameter determines whether set_locale() sets or gets a value. If you enter a specific locale name for locale, set_locale() tries to assign this locale name to the locale category specified by the category parameter. The set_locale() function returns 1 if it sets the category and 0 if it fails to set the value. If locale is 0, set_locale() returns the current value of category. If locale is "", set_locale() assigns the default value to category.
If you use ALL as category, you are specifying all locale categories. You can use ALL with locale set only to "", which sets all categories to their default values.
If category or locale is invalid, set_locale() sets the errno variable to 134 (E_PSL_SET_LOCALE_FAILED) and returns NULL.
Example
If a PATROL Agent is running under the ja_JP.eucJP locale, the following script shows how to read an SJIS-coded file and a eucJP-coded file.
set_locale("CODECVT", "ja_JP.SJIS");
data = cat("/home/users/text.sjis");
print(data);
set_locale("CODECVT", "");
data = cat("/home/users/text.euc");
print(data);
Where to go from here