Euro Currency Support in the Solaris Operating Environment

Chapter 2 Euro Currency Implementation

In the Solaris operating environment, euro support is achieved without any API changes. Instead, a new set of locales and locale extensions for single-byte and multibyte environments are provided. The codeset used by the single-byte locales is that defined by ISO/IEC 8859-15:1999.

The ISO 8859-15 codeset was created to support additional French and Finnish characters and the euro. The euro is assigned position \xA4 in the ISO 8859-15 codeset. (For this whitepaper, ISO 8859-15 is discussed only in regard to the euro.)

The euro is supported in a multibyte environment through the existing Unicode locales. Special locale extensions, however, are necessary for both single-byte and multibyte locales to support locale-specific euro currency formatting (dual-currency handling).

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

Locale 

Country 

da_DK.ISO8859-15

Denmark 

de_DE.ISO8859-15

Germany 

de_AT.ISO8859-15

Austria 

en_GB.ISO8859-15

United Kingdom 

en_IE.ISO8859-15

Ireland 

es_ES.ISO8859-15

Spain 

fi_FI.ISO8859-15

Finland 

fr_FR.ISO8859-15

France 

fr_BE.ISO8859-15

Belgium 

it_IT.ISO8859-15

Italy 

nl_NL.ISO8859-15

Netherlands 

nl_BE.ISO8859-15

Belgium 

pt_PT.ISO8859-15

Portugal 

sv_SE.ISO8859-15

Sweden 

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]; 
main(argc,argv)
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

Graphic


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.

2.1.3.1 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.

2.1.3.2 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.

2.1.3.3 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.

2.2 Euro Currency Support in Unicode Locales

To work in a multilingual and multiscript environment, the Solaris operating environment provides multibyte Unicode (UTF-8) locales. All UTF-8 locales contain the euro currency symbol at position \x20AC and, thus, no additional codeset is required to support the euro in the Solaris multibyte environment.

In all UTF-8 locales, users can input, output, and print the euro currency symbol. If an application formats currency strings using the Solaris internationalization APIs, however, national currency formatting rules apply instead of euro currency formatting rules. Locale-specific euro currency formatting is supported for multibyte locales through the "@euro" extensions.

For example:

fr.UTF-8 uses national (French) currency formatting rules. fr.UTF-8@euro uses euro currency formatting rules.

Dual-currency support in the UTF-8 locales and their extensions is the same as that in single-byte locales.

2.2.1 Locale Settings for Unicode "@euro" Extensions

The only difference between the Unicode UTF-8 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.

2.3 Input and Output Support

Input and output support information is detailed below for keyboards, fonts, and codeset conversion.

2.3.1 Keyboard Support

In April 1998, the European Commission (EC) recommendations on the euro currency symbol keyboard location referred to the three main functional levels in keyboard standards:

The European Commission (EC) proposed a short-term and long-term solution. The short-term solution was to place the euro currency symbol on the "E" key at Level 3. Here, the euro is generated by pressing two keys: AltGraph+e. The EC also recommended that the symbol be engraved on the keytop, which is common practice for many Level 3 characters on European keyboards (for example, German).

The short-term solution was chosen because it can be implemented easily on most national keyboards and is ergonomically sound. The key combination is also easy to remember, since "e" can be associated with "euro". Some countries (United Kingdom and Ireland), however, already use AltGraph+e to produce the "è" character. The EC has offered some alternative solutions for these countries. One alternative is to place the euro currency symbol at Level 3 on Keys "3" or "4", both of which already contain currency signs at Level 2 on most keyboards.

The long-term proposal is to introduce a new euro currency-symbol key on future keyboards. This new key would be in a common position at Level 1 for all countries.

2.3.1.1 Sun Keyboard Strategy

Sun has adopted the short-term proposal for the euro currency symbol keyboard location. The euro will be placed at Level 3 and will be generated by pressing AltGraph+e. For national keyboards with contentions (United Kingdom, Ireland, U.S. International), the euro will also be placed at level 3 but will be generated by pressing AltGraph+4. On U.S. International keyboards, the euro can also be generated by pressing AltGraph+5 or AltGraph+e. On keyboards in the United Kingdom, the euro can also be generated by pressing AltGraph+e. The following table summarizes the euro currency symbol location on Sun Type 6 keyboards.

Table 2-2 Euro currency symbol location on Sun Type 6 Keyboards

Type 6 Keyboard 

EU Member 

Location 

U.S. 

No 

AltGraph+4

UNIX 

No 

AltGraph+e

UNIX/Logoless 

No 

AltGraph+e

French 

Yes 

AltGraph+e

Danish 

Yes 

AltGraph+e

Italian 

Yes 

AltGraph+e

Netherlands/Dutch 

Yes 

AltGraph+e

Norwegian 

No 

AltGraph+e

Portuguese 

Yes 

AltGraph+e

Spanish 

Yes 

AltGraph+e

Swedish 

Yes 

AltGraph+e

Finnish 

Yes 

AltGraph+e

Swiss/French 

No 

AltGraph+e

Swiss/German 

No 

AltGraph+e

UK 

Yes 

AltGraph+4

Ireland 

Yes 

AltGraph+4

2.3.1.2 Keyboard Input in UTF-8 Locales

Sun also provides two additional methods to input the euro:

In the Unicode Hexadecimal input method, the user generates the euro currency symbol by typing the Unicode value for the symbol (U+20AC).

In the table lookup method, the user presses Compose+Control+L, which lists the possible scripts. Choose "Latin" and then the euro from the character table.

2.3.2 Font Support

The following fonts have been added to the Solaris operating environment to allow the euro to display and print:

monotype-arial-bold-i-normal--0-0-0-0-p-0-iso8859-15
monotype-arial-bold-r-normal--0-0-0-0-p-0-iso8859-15
monotype-arial-regular-i-normal--0-0-0-0-p-0-iso8859-15
monotype-arial-regular-r-normal--0-0-0-0-p-0-iso8859-15
monotype-courier-bold-i-normal--0-0-0-0-p-0-iso8859-15
monotype-courier-bold-r-normal--0-0-0-0-p-0-iso8859-15
monotype-courier-regular-i-normal--0-0-0-0-p-0-iso8859-15
monotype-courier-regular-r-normal--0-0-0-0-p-0-iso8859-15
monotype-times-bold-i-normal--0-0-0-0-p-0-iso8859-15
monotype-times-bold-r-normal--0-0-0-0-p-0-iso8859-15
monotype-times-regular-i-normal--0-0-0-0-p-0-iso8859-15
monotype-times-regular-r-normal--0-0-0-0-p-0-iso8859-15

Note -

For Asian locales, euro support is Asian UTF-8 locales only.


There are no additional tasks to access the new euro fonts. For information on accessing fonts in X, refer to the X Window System User's Guide.

2.3.3 Printer Support

The Solaris operating environment does not assume that printers have the correct installed fonts. System fonts are downloaded to the printer with the document. Euro fonts will also be downloaded to the printer when printing documents in the ISO 8859-15 or UTF-8 locales.

2.3.4 Codeset Conversion

Codeset conversion support for roundtrip conversion between ISO 8859-15 and UTF-8 using new iconv(1) modules has been added to the Solaris operating environment. Users can access these modules via the iconv(1) command. Developers can access these modules via the iconv(3) function. The Common Deskset Environment (CDE) dtmail utility has also been modified to ensure that outgoing e-mail based on ISO 8859-15 is tagged accordingly. Support has also been added in dtmail to ensure appropriate codeset conversion of incoming ISO 8859-15, MIME-compliant e-mail. Codeset conversion applies only if dtmail is running in a UTF-8 locale.