Oracle9iAS Reports Services Publishing Reports to the Web Release 2 (9.0.2) Part Number A92102-01 |
|
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:
Oracle NLS architecture consists of two parts:
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.
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.
NLS environment variables are automatically set to default values during Oracle9iAS installation.
Table 12-1 lists and describes NLS-related environment variables that are particularly relevant to Oracle9iAS Reports Services.
The NLS_LANG environment variable specifies the language, territory, and character set settings to be used by Oracle9iAS Reports Services. Specifically:
This environment variable is set automatically when you install Oracle9iAS. Refer to Section 12.2.1.1, "Defining the NLS_LANG Environment Variable" for more information about changing the environment variable after installing Oracle9iAS.
Note:
The syntax for NLS_LANG is:
NLS_LANG=<language_territory>.<charset>
The values are defined as follows:
language
Specifies the language and its conventions for displaying messages (including error messages) as well as day and month names. If language is not specified, then the value defaults to American.
territory
Specifies the territory and its conventions for default date format, decimal character used for numbers, currency symbol, and calculation of week and day numbers. If territory is not specified, then the value defaults to America.
charset
Specifies the character set in which data is displayed. This should be a character set that matches your language and platform. This argument also specifies the character set used for displaying messages.
Table 12-2 lists commonly used language, territory, and character values for NLS_LANG:
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 |
(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 |
(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
You define the NLS_LANG environment variable in the same way you define other environment variables on your Windows or UNIX operating system.
To define the NLS_LANG environment variable on Windows, do the following:
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.
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.
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.
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.
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.
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:
TO_CHAR
and TO_DATE
)
ORDER BY
is specified (GROUP BY
uses a binary sort unless ORDER BY
is specified)
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.
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.
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:
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.
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:
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.
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.
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.
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.
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.
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_mes
g function with a library of the same name containing the nls_appl_mesg
function with translated text.
|
![]() Copyright © 2002 Oracle Corporation. All Rights Reserved. |
|