Skip Headers

Oracle9iAS Reports Services Publishing Reports to the Web
Release 9.0

Part Number A92102-01
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Go to previous page Go to next page

12
NLS and Bidirectional Support

When you design reports to be deployed to different countries, you must consider such things as character sets and text reading order. Oracle9iAS Reports Services includes the support you need to address any issues related to these considerations: National Language Support (NLS) for character sets and bidirectional support for text reading order.

Oracle NLS makes it possible to design applications that can be deployed in several different languages. Oracle supports most European, Middle Eastern, and Asian languages. NLS enables you to:

Bidirectional support enables you to display data in either a left-to-right or right-to-left orientation, depending on the requirements of your audience.

This chapter provides a look at NLS architecture, including NLS settings relevant to Reports; explains how to specify character sets in a JSP; and offers information on bidirectional, Unicode, and translation support available through Oracle9i. It includes the following main sections:

12.1 NLS Architecture

Oracle NLS architecture consists of two parts:

12.1.1 Language-Independent Functions

Language-independent functions handle manipulation of data in an appropriate manner, depending on the language and territory of the runtime operator. Data is automatically formatted according to local date and time conventions.

12.1.2 Language-Dependent Data

With language-dependent data, you can isolate your data. This enables your application to deal only with translating strings that are unique to your application.

Because the language-dependent data is separate from the code, the operation of NLS functions is governed by the data supplied at runtime. New languages can be added and language-specific application characteristics can be altered without requiring code changes. This architecture also enables language-dependent features to be specified for each session.

12.2 NLS Environment Variables

NLS environment variables are automatically set to default values during Oracle9iAS installation.


Note:

On a given Oracle9iAS Reports Services host machine, you can specify only one language. If you are providing application server services to a multilingual audience, you must have a separate host machine for each language.


Table 12-1 lists and describes NLS-related environment variables that are particularly relevant to Oracle9iAS Reports Services.


Note:

For more information on all NLS environment variables, see the Oracle9i Globalization Support Guide on the Oracle Technology Network (http://otn.oracle.com).


Table 12-1 Environment variables particularly related to Oracle9iAS Reports Services
Variable Description

NLS_LANG

Relevant to Oracle9iAS Reports Services. The language settings used by Oracle9iAS Reports Services.

DEVELOPER_NLS_LANG

The language for the Oracle9iDS Reports Builder.

USER_NLS_LANG

The language for the Oracle9iAS Reports Runtime component.

12.2.1 NLS_LANG Environment Variable

The NLS_LANG environment variable specifies the language, territory, and character set settings to be used by Oracle9iAS Reports Services. Specifically:

The syntax for NLS_LANG is:

NLS_LANG=<language_territory>.<charset>

The values are defined as follows:

Table 12-2 lists commonly used language, territory, and character values for NLS_LANG:

Table 12-2 Commonly used NLS_LANG values
Language Language_Territory.Character Set

American

AMERICAN_AMERICA.US7ASCII

Arabic

ARABIC_UNITED ARAB EMIRATES.AR8ISO8859P6

Brazilian Portuguese

BRAZILIAN PORTUGUESE_BRAZIL.WE8DEC

Bulgarian

BULGARIAN_BULGARIA.CL8ISO8859P5

Canadian French

CANADIAN FRENCH_CANADA.WE8ISO8859P1

Catalan

CATALAN_CATALONIA.WE8ISO8859P1

Croatian

CROATIAN_CROATIA.EE8ISO8859P2

Czech

CZECH_CZECH REPUBLIC.WE8ISO8859P1

Danish

DANISH_DENMARK.WE8ISO8859P1

Dutch

DUTCH_THE NETHERLANDS.WE8ISO8859P1

Egyptian

ARABIC_UNITED ARAB EMIRATES.AR8ISO8859P6

English (American)

See American

English (United Kingdom)

ENGLISH_UNITED KINGDOM.WE8DEC

Estonian

ESTONIAN_ESTONIA.BLT8MSWIN1257

Finnish

FINNISH_FINLAND.WE8ISO8859P1

French

FRENCH_FRANCE.WE8ISO8859P1

German

GERMAN_GERMANY.WE8ISO8859P1

Greek

GREEK_GREECE.EL8ISO8859P7

Hebrew

HEBREW_ISRAEL.IW8ISO8859P8

Hungarian

HUNGARIAN_HUNGARY.EE8ISO8859P2

Icelandic

ICELANDIC_ICELAND.WE8ISO8859P1

Indonesian

INDONESIAN_INDONESIA.WE8ISO8859P1

Italian

ITALIAN_ITALY.WE8DEC

Japanese

JAPANESE_JAPAN.JA16EUC

Korean

KOREAN_KOREA.KO16KSC5601

Latin America Spanish

LATIN AMERICAN SPANISH_AMERICA.WE8DEC

Latvian

LATVIAN_LATVIA.NEE8ISO8859P4

Lithuanian

LITHUANIAN_LITHUANIA.NEE8ISO8859P4

Mexican Spanish

(see also Spanish)

MEXICAN SPANISH_MEXICO.WE8DEC

Norwegian

NORWEGIAN_NORWAY.WE8DEC

Polish

POLISH_POLAND.EE8ISO8859P2

Portuguese

PORTUGUESE_PORTUGAL.WE8DEC

Romanian

ROMANIAN_ROMANIA.EE8ISO8859P2

Russian

RUSSIAN_CIS.RU8PC855

Simplified Chinese

SIMPLIFIED CHINISE_CHINA.ZHS16CGB231280

Slovak

SLOVAK_SLOVAKIA.EE8ISO8859P2

Spanish

(see also Mexican Spanish)

SPANISH_SPAIN.WE8DEC

Swedish

SWEDISH_SWEDEN.WE8DEC

Thai

THAI_THAILAND.TH8TISASCII

Traditional Chinese

TRADITIONAL CHINESE_TAIWAN.ZHT32EUC

Turkish

TURKISH_TURKEY.WE8ISO8859P9

Ukrainian

UKRAINIAN_UKRAINE.CL8ISO8859P5

Vietnamese

VIETNAMESE_VIETNAM.VN8VN3

Your NLS_LANG setting should take into account regional differences between countries that use (basically) the same language. For example, if you want to run in French (as used in France), then you set the NLS_LANG environment variable:

NLS_LANG=FRENCH_FRANCE.WE8ISO8859P1

If you want to run in French, but this time as used in Switzerland, you would set the NLS_LANG environment variable:

NLS_LANG=FRENCH_SWITZERLAND.WE8ISO8859P1

12.2.1.1 Defining the NLS_LANG Environment Variable

You define the NLS_LANG environment variable in the same way you define other environment variables on your Windows or UNIX operating system.

12.2.1.1.1 Windows

To define the NLS_LANG environment variable on Windows, do the following:

  1. Open the Windows registry.


    Note:

    Back up your registry before you edit it.


  2. Expand the HKEY_LOCAL_MACHINE node, then expand the SOFTWARE node.

  3. Click ORACLE to display the Oracle environment variables in the right panel of the Registry Editor.

  4. Double-click the NLS_LANG environment variable.

  5. Type the new value for NLS_LANG in the Value data text box.

  6. Click OK.

12.2.1.1.2 UNIX

To define the NLS_LANG environment variable on the UNIX platform, set it in the shell script rwrun.sh, located in your ORACLE_HOME/bin directory.

12.2.1.2 Character Sets

The character set component of the NLS environment variables specifies the character set in which data is represented in your environment. When data is transferred from a system using one character set to a system using another character set, it is processed and displayed correctly on the second system, even though some characters might be represented by different binary values in the character sets.

12.2.1.2.1 Character Set Design Considerations

If you are designing a multilingual application, or even a single-language application that runs with multiple character sets, you need to determine the character set most widely used at runtime and then generate with the NLS environment variable set to that particular character set.

If you design and generate an application in one character set and run it in another character set, performance can suffer. Furthermore, if the runtime character set does not contain all the characters in the generate character set, then question marks appear in place of the unrecognized characters.

Portable Document Format (PDF) supports multibyte character sets.

12.2.1.2.2 Font Aliasing on Windows Platforms

There might be situations where you create an application with a specific font but find that a different font is being used when you run that application. You would most likely encounter this when using an English font (such as MS Sans Serif or Arial) in environments other than Western European. This occurs because Oracle9iAS Reports Services checks to see if the character set associated with the font matches the character set specified by the language environment variable. If the two do not match, Oracle9iAS Reports Services automatically substitutes the font with another font whose associated character set matches the character set specified by the language environment variable. This automatic substitution assures that the data being returned from the database gets displayed correctly in the application.


Note:

If you enter local characters using an English font, then Windows does an implicit association with another font.


There might be cases, however, where you do not want this substitution to take place. You can avoid this substitution by mapping all desired fonts to the WE8ISO8859P1 character set in the font alias file (uifont.ali). For example, if you are unable to use the Arial font in your application, you can add the following line to your font alias file (located at ORACLE_HOME\TOOLS\COMMON\):

ARIAL.....=ARIAL.....WE8ISO8859P1

Each line in the uifont.ali file takes the following syntax:

<Face>.<Size>.<Style>.<Weight>.<Width>.<CharSet>=<Face>.<Size>.<Style>.<Weight>.
<Width>.<CharSet>

In this example, you're saying that any ARIAL font should be mapped to the same value, but with the WE8ISO8859P1 character set.

Refer to Section 12.2, "NLS Environment Variables" for more information about the language environment variables.

12.2.1.3 Language and Territory

While the character set ensures that the individual characters needed for each language are available, support for national conventions provides correct localized display of data items.

The specified language determines the default conventions for the following characteristics:

For example, if the language is set to French, then the following messages in English are converted to French:

English:
ORA-00942: table or view does not exist
FRM-10043: Cannot open file.

French:
ORA-0092: table ou vue inexistante
FRM-10043: Ouverture de fichier impossible

The specified territory determines the conventions for the following default date and numeric formatting characteristics:

For example, if the territory is set to France, then the numbers are formatted using a comma as the decimal character.

12.2.2 DEVELOPER_NLS_LANG and USER_NLS_LANG Environment Variables

If you must use two sets of resource and message files at the same time, then two other language environment variables are available. These can be used after Oracle9iAS installation is completed.

The syntax for DEVELOPER_NLS_LANG and USER_NLS_LANG is the same as for the NLS_LANG environment variable. That is:

DEVELOPER_NLS_LANG=<language_territory>.<charset>
USER_NLS_LANG=<language_territory>.<charset>

Use these environment variables in lieu of the NLS_LANG environment variable in the following situations:

If these environment variables are not specifically set, then NLS_LANG default values will be used.

12.3 Specifying a Character Set in a JSP or XML File

If you are producing HTML with your JSP, then you may need to add a character set to your JSP file using the following syntax (this one specifies a Japanese character set):

<META http-equiv="Content-Type" content="text/html;charset=shift_jis">

Additionally, if you plan on outputting a report to XML, you may wish to include a character set in the XML Prolog Value property in the Builder's Property Inspector, following this syntax:

<?xml version="1.0" encoding="shift_jis" ?>

In both instances, the values expressed for the character set should call a character set that is compatible with the one specified for the host environment. The values for character sets used on the Web are different from the values expressed in the NLS_LANG environment variable. Table 12-3 lists commonly used values for the charset or encoding parameter:


Note:

The values for charset and encoding are not case sensitive. You can enter them in lower- or uppercase.



Note:

to set the character set in a .rdf file that you plan to use to generate HTML, you must ensure that the Before Report Escape property includes the following:

charset="text/html;charset=&encoding"

&encoding is then replaced at runtime with the appropriate setting.


Table 12-3 Valid values for a charset or encoding parameter
Language Valid Character Set(s)

Afrikaans

iso-8859-1, windows-1252

Albanian

iso-8859-1, windows-1252

Arabic

iso-8859-6

Basque

iso-8859-1, windows-1252

Bulgarian

iso-8859-5

Byelorussian

iso-8859-5

Catalan

iso-8859-1, windows-1252

Croatian

iso-8859-2

Czech

iso-8859-2

Danish

iso-8859-1, windows-1252

Dutch

iso08859-1, windows-1252

English

iso-8859-1, windows-1252

Esperanto

iso-8859-3 (not widely supported in browsers)

Estonian

iso-8859-15

Faroese

iso-8859-1, windows-1252

Finnish

iso-8859-1, windows-1252

French

iso-8859-1, windows-1252

Galician

iso-8859-1, windows-1252

German

iso-8859-1, windows-1252

Greek

iso-8859-1

Hebrew

iso-8859-8

Hungarian

iso-8859-2

Icelandic

iso-8859-1, windows-1252

Inuit languages

iso-8859-10 (not widely supported in browsers)

Irish

iso-8859-1

Italian

iso-8859-1

Japanese

shift_jis, iso-2202-jp, euc-jp

Korean

euc-kr

Lapp

iso-8859-10 (not widely supported in browsers)

Latvian

iso-8859-13, windows-1257

Lithuanian

iso-8859-13, windows-1257

Macedonian

iso-8859-5

Maltese

iso-8859-3 (not widely supported in browsers)

Norwegian

iso-8859-1, windows-1252

Polish

iso-8859-2

Portuguese

iso-8859-1, windows-1252

Romanian

iso-8859-2

Russian

koi-8-r, iso-8859-5

Scottish

iso-8859-1, windows-1252

Serbian

iso-8859-5

Slovak

iso-8859-2

Slovenian

iso-8859-2

Spanish

iso-8859-1, windows-1252

Swedish

iso-8859-1, windows-1252

Turkish

iso-8859-9, windows-1254

Ukrainian

iso-8859-5

12.4 Bidirectional Support

Bidirectional support enables you to design applications in Middle Eastern and North African languages whose natural writing direction is right to left. Bidirectional support enables you to control:

When you are designing bidirectional applications, you might want to use the NLS environment variables DEVELOPER_NLS_LANG and USER_NLS_LANG rather than NLS_LANG. For example, if you want to use an American interface while developing an Arabic application in a Windows environment, then set these environment variables as follows:

DEVELOPER_NLS_LANG=AMERICAN_AMERICA.AR8MSWIN1256
USER_NLS_LANG=ARABIC_UNITED ARAB EMIRATES.AR8MSWIN1256

Note that, in this example, the DEVELOPER_NLS_LANG environment variable uses an Arabic character set. Refer to "NLS Environment Variables" for more information about environment variables.

12.5 Unicode

Unicode is a global character set that allows multilingual text to be displayed in a single application. This enables multinational corporations to develop a single multilingual application and deploy it worldwide.

Global markets require a character set that:

12.5.1 Unicode Support

Oracle9iAS Reports Services provides Unicode support. If you use Unicode, you are able to display multiple languages, both single-byte languages such as Western Europe, Eastern Europe, Bidirectional Middle Eastern, and multibyte Asian languages such as Chinese, Japanese, and Korean (CJK) in the same application.

Use of a single character set that encompasses all languages eliminates the need to have various character sets for various languages. For example, to display a multibyte language such as Japanese, the NLS_LANG environment variable must be set to the following:

NLS_LANG=JAPAN_JAPANESE.JA16SJIS

To display a single-byte language such as German, NLS_LANG must be set to the following:

NLS_LANG=GERMAN_GERMANY.WE8ISO8859P1

The obvious disadvantage of this scheme is that applications can only display characters from one character set at a time. Mixed character set data is not possible.

With the Unicode character set, you can set the character set portion of NLS_LANG to UTF8 instead of a specific language character set. This allows characters from different languages and character sets to be displayed simultaneously. For example, to display Japanese and German together on the screen, the NLS_LANG variable must be set to one of the following:

NLS_LANG=JAPAN_JAPANESE.UTF8

NLS_LANG=GERMAN_GERMANY.UTF8

Unicode capability gives the application developer and end user the ability to display multilingual text in a form. This includes text from a database containing Unicode, multilingual text, text in graphical user interface (GUI) objects (for example, button labels), text input from the keyboard, and text from the clipboard. Oracle9iAS Reports Services currently supports Unicode on Windows.


Note:

If you develop applications for the Web, then you can use Unicode because of the Unicode support provided by Java through the browser.


12.5.2 Unicode Font Support

Oracle9iAS Reports Services relies on the operating system for the font and input method for different languages. To enter and display text in a particular language, you must be running a version of the operating system that supports that language. Font support is limited but not restricted to the operating system font.

Windows NT release 4.0 provides True Type Big Fonts. These fonts contain all the characters necessary to display or print multilingual text. If you try to type, display, or print multilingual text and see unexpected characters, then you are probably not using a Big Font. Big Fonts provided by Microsoft under Windows NT release 4.0 are as follows:

Third-party Unicode fonts are also available.

12.5.3 Enabling Unicode Support

To enable Unicode support, set the NLS_LANG environment variable as follows:

NLS_LANG=<language_territory>.UTF8

Refer to "NLS Environment Variables" for more information about environment variables.

12.5.4 Using ALTER SESSION

You can use the SQL command ALTER SESSION to override some NLS defaults, if you are connected to an Oracle database via the USERID keyword or have connected via the Connect dialog in the Reports Builder. For example, suppose you are building a report against an Oracle database that will publish data to different geographic locations. You might want to change the currency symbol, thousands grouping, and decimal indicator that the Oracle database uses when it formats a currency field depending on a user parameter. You could accomplish this task in several ways, but one method is to alter the Oracle database session NLS_LANG variable in a Before Report trigger.


Note:

ALTER SESSION does not apply to pluggable data source queries (for example, JDBC and XML).



Note:

For more information on the ALTER SESSION command, see the Oracle9i SQL Reference, available on the Oracle Technology Network (http://otn.oracle.com).


12.6 Translating Applications

In any Oracle9iAS Reports Services application, you see many types of messages, including:

If the NLS environment variable is set correctly and the appropriate message files are available, then translation of messages for the first two items is done for you. To translate messages and boilerplate text defined as part of the application, you can use the Oracle translation tool, TranslationHub, and you might also find it useful to use PL/SQL Libraries for strings of code.


Note:

You'll find information about using TranslationHub on the Oracle9iDS documentation CD and on the Oracle Technology Network (http://otn.oracle.com).


Manual translation is required for constant text within a PL/SQL block because that text is not clearly delimited, but is often built up from variables and pieces of strings. To translate these strings, you can use PL/SQL libraries to implement a flexible message structure.

You can use attachable PL/SQL libraries to implement a flexible message function for messages that are displayed programmatically by the built-in routine SRW.MESSAGE, or by assigning a message to a display item from a trigger or procedure. The library can be stored on the host and dynamically attached at runtime. At runtime, based on a search path, you can pull in the attached library. For example, a library might hold only the Italian messages:

FUNCTION nls_appl_mesg(inexe_no NUMBER)
RETURN CHAR
IS
   msg CHAR(80):
BEGIN
   IF      index_no = 1001 THEN
      msg := 'L' 'impiegato che Voi cercate non esiste...';
   ELSEIF  index_no = 1002 THEN
      msg := 'Lo stipendio non puo essere minore di zero.':
   ELSEIF  ...
   .
   .
   ELSE
      msg := 'ERRORE: Indice messaggio inesistente.';
   END IF;
   RETURN msg;
END;

A routine like this could be used anywhere a character expression would normally be valid. For example, to display text with the appropriately translated application message, you might include the following code:

Change_Alert_Message('My_Error_Alert', nls_appl_mesg(1001));
n := Show_Alert('My_Error_Alert');

To change the application to another language, simply replace the PL/SQL library containing the nls_appl_mesg function with a library of the same name containing the nls_appl_mesg function with translated text.


Go to previous page Go to next page
Oracle
Copyright © 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index