Euro Currency Support in the Solaris Operating Environment

2.1 Euro Currency Support in Single-Byte Locales

The Solaris operating environment provides a set of single-byte locales to support the euro. In each locale, a user can input, output, and print the euro.

Table 2-1 Single-Byte Euro Locales










United Kingdom 





















If an application formats currency strings using the Solaris internationalization APIs, however, national currency formatting rules apply instead of euro currency formatting rules in the locales listed in Table 2-1.

Because most users want to continue using their national currencies during the earlier part of the transition period, Sun has opted to provide national currency support for these locales rather than euro currency support. Users may still input, output, and print the euro during the transition period. For users and developers who want both input, output, and print support and locale-specific euro currency formatting, the Solaris operating environment provides an extension to each ISO 8859-15 locale.

2.1.1 Locale-Specific Euro Currency Formatting ("@euro" Extension)

As for other currencies, the euro is a cultural element--each country will format euro currency strings using its own national convention. The ISO 8859-15 locales use national currency conventions to format currency strings. To provide locale-specific euro currency formatting, the Solaris operating environment provides a "@euro" extension to these locales. The "@" modifier is part of the XPG-4 standard and allows finer granularity in locale definitions.

For example:

fr_FR.ISO8859-15 uses national (French) currency formatting rules. fr_FR.ISO8859-15@euro uses euro currency formatting rules.

Each ISO 8859-15 locale supports the "@euro" extension.

Note -

Locales with the "@euro" extension are not available to users in the language selection during login. They are provided to support currency string formatting for the euro.

2.1.2 Dual-Currency Support in the Euro Locales

In the Solaris operating environment, accessing locale data in ISO 8859-15 is no different than any other locale. For more information on locale-specific data, refer to the latest Solaris International Language Environments Guide. However, using these locales in a dual-currency environment requires additional explanation.

One business requirement during the transition period (January 1, 1999 to December 31, 2002) is to display prices in both the national currency and the euro. The Solaris operating environment supports both using the "@euro" extension as shown in the program example below.

Example: Dual-Currency Handling in Solaris

#include <stdio.h>
#include <math.h>
#include <ctype.h>
#include <locale.h>
#include <monetary.h> 
char buf[20]; 
int argc; 
char *argv[];
	double num = atoi(argv[1]);
	setlocale(LC_MONETARY, "fr_FR.ISO8859-15");
	strfmon(buf, sizeof(buf), "%n", num);
	printf("National currency format is  %s\n",buf);
	strfmon(buf, sizeof(buf), "%i", num);
	printf("International currency format is %s\n",buf);
	setlocale(LC_MONETARY, "fr_FR.ISO8859-15@euro");
	num=num*2; strfmon*buf, sizeof(buf), "%n", num);
	printf("National currency format is %s\n",buf);
	strfmon(buf, sizeof(buf), "%i", num);
	printf("International currency format is %s\n",buf);

Note -

For illustration purposes, the following example uses a fictional exchange rate conversion (1 French Franc = 2 euro). Exchange rate support is not provided in the Solaris operating environment and should be handled by the application.

The output is: show below in Figure 2-1.

Figure 2-1 Euro sample output


Note -

To change locales in a multithreaded application, setlocale() should be called prior to using any locale-sensitive routine. Using setlocale() to query the current locale is safe, and can be used anywhere in a multithreaded application.

2.1.3 Locale Settings for ISO 8859-15 Locales

Locale settings (LC_* but excluding LC_MESSAGES) are defined in the Solaris locale definition files. These files are defined and supplied by Sun's Localization Centers and are based on XPG-4 specifications. For further information on the format of locale definition files, refer to Internationalization Guide, Version 2: Open Group Guide. The detailed changes made to the LC_* settings of ISO 8859-15 locales to support the euro are listed below. LC_MESSAGES

LC_MESSAGES for each ISO 8859-15 locale is symbolically linked to its ISO 8859-1 equivalent. It is possible that this linkage will cause codeset compatibility issues, since messages will be encoded in ISO 8859-1 and not ISO 8859-15. This should have minimal impact, however, because the characters being replaced in ISO 8859-1 are rarely used. LC_TIME, LC_NUMERIC

LC_TIME and LC_NUMERIC in the ISO 8859-15 locales will be in the same format as their ISO 8859-1 locale equivalents. LC_CTYPE, LC_COLLATE

LC_CTYPE and LC_COLLATE will be <locale>_iso8859-15 specific. Most of the delta characters in ISO 8859-15 (those different from ISO 8859-1) can be classified as uppercase or lowercase, thus requiring a locale-specific ISO 8859-15 classification. The delta characters will also be sorted differently than the characters that they replaced in ISO 8859-1 and must use a separate locale-specific ISO 8859-15 sort sequence.

2.1.4 Locale Settings for ISO 8859-15 "@euro" Extensions

The only difference between ISO 8859-15 locales and their "@euro" extensions is in LC_MONETARY. In locales using the "@euro" extension, LC_MONETARY will contain locale-specific formatting information for the euro.