Oracle9i Database Globalization Support Guide Release 2 (9.2) Part Number A96529-01 |
|
This chapter shows how to customize locale data. It includes the following topics:
The Oracle Locale Builder offers an easy and efficient way to customize locale data. It provides a graphical user interface through which you can easily view, modify, and define locale-specific data. It extracts data from the text and binary definition files and presents them in a readable format so that you can process the information without worrying about the formats used in these files.
The Oracle Locale Builder handles four types of locale definitions: language, territory, character set, and linguistic sort. It also supports user-defined characters and customized linguistic rules. You can view definitions in existing text and binary definition files and make changes to them or create your own definitions.
This section contains the following topics:
The Oracle Locale Builder uses Unicode characters in many of its functions. For example, it shows the mapping of local character code points to Unicode code points.Therefore, Oracle Corporation recommends that you use a Unicode font to fully support the Oracle Locale Builder. If a character cannot be rendered with your local fonts, then it will probably be displayed as an empty box.
There are many Windows TrueType
and OpenType
fonts that support Unicode. Oracle Corporation recommends using the Arial Unicode MS font from Microsoft, because it includes about 51,000 glyphs and supports most of the characters in Unicode 3.1.
After installing the Unicode font, add the font to the Java Runtime font.properties
file so it can be used by the Oracle Locale Builder. The font.properties
file is located in the $JAVAHOME/lib
directory. For example, for the Arial Unicode MS font, add the following entries to the font.properties
file:
dialog.n
=Arial Unicode MS, DEFAULT_CHARSET dialoginput.n
=Arial Unicode MS, DEFAULT_CHARSET serif.n
=Arial Unicode MS, DEFAULT_CHARSET sansserif.n
=Arial Unicode MS, DEFAULT_CHARSET
n
is the next available sequence number to assign to the Arial Unicode MS font in the font list. Java Runtime searches the font mapping list for each virtual font and use the first font available on your system.
After you edit the font.properties
file, restart the Oracle Locale Builder.
There are fewer choices of Unicode fonts for non-Windows platforms than for Windows platforms. If you cannot find a Unicode font with satisfactory character coverage, then use multiple fonts for different languages. Install each font and add the font entries into the font.properties
file using the steps described for the Windows platform.
For example, to display Japanese characters on Sun Solaris using the font ricoh-hg
mincho
, add entries to the existing font.properties
file in $JAVAHOME/lib
in the dialog
, dialoginput
, serif
, and sansserif
sections. For example:
serif.plain.3=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
Ensure that the ORACLE_HOME
initialization parameter is set before starting the Builder.
Start the Oracle Locale Builder by changing into the $ORACLE_HOME/ocommon/nls/lbuilder
directory and issuing the following command:
% lbuilder
After you start the Oracle Locale Builder, the screen shown in Figure 12-1 appears.
Text description of the illustration pic1.gif
Before using Oracle Locale Builder for a specific task, you should become familiar with screens and dialog boxes that include the following:
When you choose New Language, New Territory, New Character Set, or New Linguistic Sort, the first screen you see is labelled General. Click Show Existing Definitions to see the Existing Definitions dialog box.
The Existing Definitions dialog box enables you to open locale objects by name. If you know a specific language, territory, linguistic sort (collation), or character set that you want to start with, click its displayed name. For example, you can open the AMERICAN
language definition file as shown in Figure 12-2.
Text description of the illustration pic17.gif
Choosing AMERICAN
opens the lx00001.nlb
file.
Language and territory abbreviations are for reference only and cannot be opened.
In the Tools menu, choose View Log to see the Session Log dialog box. The Session Log dialog box shows what actions have been taken in the current session. The Save Log button enables you to keep a record of all changes. Figure 12-3 shows an example of a session log.
Text description of the illustration pic22.gif
The NLT file is a text file with the file extension .nlt
that shows the settings for a specific language, territory, character set, or linguistic sort. The Preview NLT screen presents a readable form of the file so that you can see whether the changes you have made look correct. You cannot modify the NLT file from the Preview NLT screen. You must use the specific elements of the Oracle Locale Builder to modify the NLT file.
Figure 12-4 shows an example of the Preview NLT screen for a user-defined language called AMERICAN FRENCH
.
Text description of the illustration pic6.gif
You can see the Open File dialog box by going to the File menu, choosing Open, and choosing By File Name. Then choose the NLB file that you want to modify or use as a template. An NLB file is a binary file with the file extension .nlb
that contains the binary equivalent of the information in the NLT file. Figure 12-5 shows the Open File dialog box with the lx00001.nlb
file selected. The Preview panel shows that this NLB file is for the AMERICAN
language.
Text description of the illustration pic16.gif
This section shows how to create a new language based on French. This new language is called AMERICAN FRENCH
. First, open FRENCH
from the Existing Definitions dialog box. Then change the language name to AMERICAN FRENCH
and the Language Abbreviation to AF in the General dialog box. Leave the default values for the other settings. Figure 12-6 shows the resulting General dialog box.
Text description of the illustration pic2.gif
The following restrictions apply when choosing names for locale objects such as languages:
The valid range for the language ID field for a user-defined language is 1,000 to 10,000. You can accept the value provided by Oracle Locale Builder or you can specify a value within the range.
Figure 12-7 shows how to set month names using the Month Names tab.
Text description of the illustration pic3.gif
All names are shown as they appear in the NLT file. If you choose Yes for capitalization, the month names are capitalized in your application, but they do not appear capitalized in the Month Names screen.
Figure 12-8 shows the Day Names screen.
Text description of the illustration pic4.gif
You can choose day names for your user-defined language. All names are shown as they appear in the NLT file. If you choose Yes for capitalization, the day names are capitalized in your application, but they do not appear capitalized in the Day Names screen.
This section shows how to create a new territory called REDWOOD SHORES
and use RS
as a territory abbreviation. The new territory is not based on an existing territory definition.
The basic tasks are to assign a territory name and choose formats for the calendar, numbers, date and time, and currency. Figure 12-9 shows the General screen with REDWOOD SHORES
set as the Territory Name, 1001
set as the Territory ID, and RS
set as the Territory Abbreviation.
Text description of the illustration pic7.gif
The valid range for a territory ID for a user-defined territory is 1,000 to 10,000.
Figure 12-10 shows settings for calendar formats.
Text description of the illustration pic8.gif
Tuesday is set as the first day of the week, and the first week of the calendar year is set as an ISO week. The screen displays a sample calendar.
See Also:
|
Figure 12-11 shows date and time settings.
Text description of the illustration pic9.gif
Sample formats are displayed when you choose settings from the drop-down menus. In this case, the Short Date Format is set to YY/MM/DD
. The Short Time Format is set to HH24:MI:SS
. The Long Date Format is set to YYYY/MM/DD DAY
. The Long Time Format is set to HH12:MI:SS AM
.
You can also enter your own formats instead of using the selection from the drop-down menus.
Figure 12-12 shows settings for number formats.
Text description of the illustration pic10.gif
A period has been chosen for the Decimal Symbol. The Negative Sign Location is set to be on the left of the number. The Numeric Group Separator is a comma. The Number Grouping is set to 4 digits. The List Separator is a comma. The Measurement System is metric. The Rounding Indicator is 4.
You can enter your own values instead of using the drop-down menus.
Sample formats are displayed when you choose settings from the drop-down menus.
Figure 12-13 shows settings for currency formats in the Monetary dialog box.
Text description of the illustration pic11.gif
The Local Currency Symbol is set to $
. The Alternative Currency Symbol is the Euro symbol. The Currency Presentation shows one of several possible sequences of the local currency symbol, the debit symbol, and the number. The Decimal Symbol is the period. The Group Separator is the comma. The Monetary Number Grouping is 3
. The Monetary Precision, or number of digits after the decimal symbol, is 3
. The Credit Symbol is +
. The Debit Symbol is -
. The International Currency Separator is a blank space, so it is not visible in the screen. The International Currency Symbol (ISO currency symbol) is USD
. Sample currency formats are displayed, based on the values you have selected.
You can enter your own values instead of using the drop-down menus.
The rest of this section contains the following topics:
The time zone files contain the valid time zone names. The following information is included for each time zone:
Two time zone files are included in the Oracle home directory. The default file is oracore/zoneinfo/timezone.dat
. It contains the most commonly used time zones. A larger set of time zones is included in oracore/zoneinfo/timezlrg.dat
. Unless you need the larger set of time zones, use the default time zone file because database performance is better.
To use the larger time zone file, complete the following tasks:
ORA_TZFILE
environment variable to the full path name of the timezlrg.dat
file.After you have used the timezlrg.dat
file, you must continue to use it unless you are sure that none of the additional time zones are used for data that is stored in the database. Also, all databases that share information must use the same time zone file.
To view the time zone names, enter the following statement:
SQL> SELECT * FROM V$TIMEZONE_NAMES;
Oracle supports several calendars. All of them are defined with data derived from Oracle's globalization support, but some of them may require the addition of ruler eras or deviation days in the future. To add this information without waiting for a new release of the Oracle database server, you can use an external file that is automatically loaded when the calendar functions are executed.
Calendar data is first defined in a text file. The text definition file must be converted into binary format. You can use the NLS Calendar Utility (lxegen
) to convert the text definition file into binary format.
The name of the text definition file and its location are hard-coded and depend on the platform. On UNIX platforms, the file name is lxecal.nlt
. It is located in the $ORACLE_HOME/ocommon/nls
directory. A sample text definition file is included in the directory.
The lxegen
utility produces a binary file from the text definition file. The name of the binary file is also hard-coded and depends on the platform. On UNIX platforms, the name of the binary file is lxecal.nlb
. The binary file is generated in the same directory as the text file and overwrites an existing binary file.
After the binary file has been generated, it is automatically loaded during system initialization. Do not move or rename the file.
Invoke the calendar utility from the command line as follows:
% lxegen
See Also:
|
You can display and print the code charts of character sets with the Oracle Locale Builder.
Figure 12-14 shows the opening screen for Oracle Locale Builder.
Text description of the illustration pic1.gif
In the File menu, choose New. In the New menu, choose Character Set. Figure 12-15 shows the resulting screen.
Text description of the illustration charsetg.gif
Click Show Existing Definitions. Highlight the character set you wish to display. Figure 12-16 shows the Existing Definitions dialog box with US7ASCII highlighted.
Text description of the illustration charsets.gif
Click Open to choose the character set. Figure 12-17 shows the General screen when US7ASCII has been chosen.
Text description of the illustration us7ascii.gif
Click the Character Data Mapping tab. Figure 12-18 shows the Character Data Mapping screen for US7ASCII.
Text description of the illustration chdatama.gif
Click View CodeChart. Figure 12-19 shows the code chart for US7ASCII.
Text description of the illustration codechar.gif
It shows the encoded value of each character in the local character set, the glyph associated with each character, and the Unicode value of each character in the local character set.
If you want to print the code chart, then click Print Page.
You can customize a character set to meet specific user needs. In Oracle9i, you can extend an existing encoded character set definition. User-defined characters are often used to encode special characters that represent the following:
This section describes how Oracle supports user-defined characters. It includes the following topics:
User-defined characters are typically supported within East Asian character sets. These East Asian character sets have at least one range of reserved code points for user-defined characters. For example, Japanese Shift-JIS preserves 1880 code points for user-defined characters. They are shown in Table 12-1.
The Oracle character sets listed in Table 12-2 contain predefined ranges that support user-defined characters.
The code point value that represents a particular character can vary among different character sets. A Japanese kanji character is shown in Figure 12-20.
Text description of the illustration char2.gif
The following table shows how the character is encoded in different character sets.
Unicode Encoding | JA16SJIS Encoding | JA16EUC Encoding | JA16DBCS Encoding |
---|---|---|---|
4E9C |
889F |
B0A1 |
4867 |
In Oracle, all character sets are defined in terms of Unicode 3.1 code points. That is, each character is defined as a Unicode 3.1 code value. Character conversion takes place transparently to users by using Unicode as the intermediate form. For example, when a JA16SJIS client connects to a JA16EUC database, the character shown inFigure 12-20 has the code point value 889F when it is entered from the JA16SJIS client. It is internally converted to Unicode (with code point value 4E9C) and then converted to JA16EU (code point value B0A1).
Unicode 3.1 reserves the range E000-F8FF for the Private Use Area (PUA). The PUA is intended for private use character definition by end users or vendors.
User-defined characters can be converted between two Oracle character sets by using Unicode 3.1 PUA as the intermediate form, the same as standard characters.
User-defined character cross-references between Japanese character sets, Korean character sets, Simplified Chinese character sets and Traditional Chinese character sets are contained in the following distribution sets:
${ORACLE_HOME}/ocommon/nls/demo/udc_ja.txt ${ORACLE_HOME}/ocommon/nls/demo/udc_ko.txt ${ORACLE_HOME}/ocommon/nls/demo/udc_zhs.txt ${ORACLE_HOME}/ocommon/nls/demo/udc_zht.txt
These cross-references are useful when registering user-defined characters across operating systems. For example, when registering a new user-defined character on both a Japanese Shift-JIS operating system and a Japanese IBM Host operating system, you may want to use F040 on the Shift-JIS operating system and 6941 on IBM Host operating system for the new user-defined character so that Oracle can convert correctly between JA16SJIS and JA16DBCS. You can find out that both Shift-JIS UDC value F040 and IBM Host UDC value 6941 are mapped to the same Unicode PUA value E000 in the user-defined character cross-reference.
By default, the Oracle Locale Builder generates the next available character set name for you. You can also generate your own character set name. Use the following format for naming character set definition NLT files:
lx2
dddd
.nlt
dddd
is the 4-digit Character Set ID in hex.
When you modify a character set, observe the following guidelines:
If a character set is derived from an existing Oracle character set, Oracle Corporation recommends using the following character set naming convention:
<Oracle_character_set_name
><organization_name
>EXT<version
>
For example, if a company such as Sun Microsystems adds user-defined characters to the JA16EUC character set, the following character set name is appropriate:
JA16EUCSUNWEXT1
The character set name contains the following parts:
JA16EUC
is the character set name defined by OracleSUNW
represents the organization name (company stock trading abbreviation for Sun Microsystems)EXT
specifies that this character set is an extension to the JA16EUC character set1
specifies the versionThis section shows how to create a new character set called MYCHARSET
with 10001
for its Character Set ID. The example starts with the US7ASCII character set and adds 10 Chinese characters. Figure 12-21 shows the General screen.
Text description of the illustration pic12.gif
Click Show Existing Definitions and choose the US7ASCII character set from the Existing Definitions dialog box.
The ISO Character Set ID and Base Character Set ID fields are optional. The Base Character Set ID is used for inheriting values so that the properties of the base character set are used as a template. The Character Set ID is automatically generated, but you can override it. The valid range for a user-defined character set ID is 10,000 to 20,000. The ISO Character Set ID field remains blank for user-defined character sets.
Figure 12-22 shows the Type Specification screen.
Text description of the illustration pic13.gif
The Character Set Category is ASCII_BASED
. The BYTE_UNIQUE
flag is checked.
When you have chosen an existing character set, the fields for the Type Specification screen should already be set to appropriate values. You should keep these values unless you have a specific reason for changing them. If you need to change the settings, use the following guidelines:
FIXED_WIDTH
is to identify character sets whose characters have a uniform length.BYTE_UNIQUE
means the single-byte range of code points is distinct from the multibyte range. The code in the first byte indicates whether the character is single-byte or multibyte. An example is JA16EUC.DISPLAY
identifies character sets that are used only for display on clients and not for storage. Some Arabic, Devanagari, and Hebrew character sets are display character sets.SHIFT
is for character sets that require extra shift characters to distinguish between single-byte characters and multibyte characters.
See Also:
"Variable-width multibyte encoding schemes" for more information about shift-in and shift-out character sets |
Figure 12-23 shows how to add user-defined characters.
Text description of the illustration pic14.gif
Open the Character Data Mapping screen. Highlight the character that you want to add characters after in the character set. In this example, the 0xfe
local character value is highlighted.
You can add one character at a time or use a text file to import a large number of characters. In this example, a text file is imported. The first column is the local character value. The second column is the Unicode value. The file contains the following character values:
88a2 963f
88a3 54c0
88a4 611b
88a5 6328
88a6 59f6
88a7 9022
88a8 8475
88a9 831c
88aa 7a50
88ab 60aa
In the File menu, choose Import User-Defined Customers Data.
Figure 12-24 shows that the imported characters are added after 0xfe
in the character set.
Text description of the illustration pic15.gif
If you have Java products such as JDBC or SQLJ in your applications and want them to support user-defined characters, then customize your character set as desired. Then generate and install a special Java zip file (gss_custom.zip
) into your Oracle home directory.
On UNIX, enter a command similar to the following:
$ORACLE_HOME/JRE/bin/jre -classpath $ORACLE_HOME/jlib/gss-1_1.zip: $ORACLE_HOME/jlib/gss_charset-1_2.zip Ginstall lx22710.nlt
On Windows, enter a command similar to the following:
%JREHOME%\bin\jre.exe -classpath %ORACLE_HOME%\jlib\gss-1_1.zip: %ORACLE_HOME%\jlib\gss_charset-1_2.zip Ginstall lx22710.nlt
%JREHOME%
is the C:\Program Files\Oracle\jre\version_num
directory.
lx22710.nlt
is an example of an NLT file created by customizing a character set using the Oracle Locale Builder.
These commands generate a gss_custom.zip
file in the current directory. If you need to add support for more than one customized character set, you can append their definitions to the same gss_custom.zip
file by re-issuing the command for each of the additional customized character sets. For example, enter the following commands on UNIX:
$ORACLE_HOME/JRE/bin/jre -classpath $ORACLE_HOME/jlib/gss-1_1.zip: $ORACLE_HOME/jlib/gss_charset-1_2.zip Ginstall lx22710.nlt
$ORACLE_HOME/JRE/bin/jre -classpath $ORACLE_HOME/jlib/gss-1_1.zip: $ORACLE_HOME/jlib/gss_charset-1_2.zip Ginstall lx22711.nlt $ORACLE_HOME/JRE/bin/jre -classpath $ORACLE_HOME/jlib/gss-1_1.zip: $ORACLE_HOME/jlib/gss_charset-1_2.zip Ginstall lx22712.nlt
lx22710.nlt
, lx22711.nlt
and lx22712.nlt
are contained in gss_custom.zip
.
After gss_custom.zip
has been created, store it in the
$ORACLE_HOME/ocommon/nls/admin/data
directory. Enter the following command:
% cp gss_custom.zip $ORACLE_HOME/ocommon/nls/admin/data
You may want to add the gss_custom.zip
file to the following Java components:
Load the zip file into the database.
Enter the following command on UNIX:
%loadjava -u sys/passwd
-grant EXECUTE -synonym -r -r -v gss_custom.zip
Enter the following command on Windows:
loadjava -u sys/passwd
-grant EXECUTE -synonym -r -r -v gss_custom.zip
Replace passwd
by the password for SYS
.
Edit the jserv.properties
file.
On UNIX, add the following line:
wrapper.classpath = $ORACLE_HOME/ocommon/nls/admin/data/gss_custom.zip
On Windows, add the following line:
wrapper.classpath = %ORA_HOME%\ocommon\nls\admin\data\gss_custom.zip
Modify the CLASSPATH
.
Enter the following command on UNIX:
% setenv CLASSPATH $ORACLE_HOME/ocommon/nls/admin/data/gss_custom.zip
On Windows, add %ORACLE_HOME%\ocommon\nls\admin\data\gss_custom.zip
to the existing CLASSPATH
.
This section shows how to create a new multilingual linguistic sort called MY_GENERIC_M
with a Collation ID of 10001
. The GENERIC_M
linguistic is used as the basis for the new linguistic sort. Figure 12-25 shows how to begin.
Text description of the illustration pic18.gif
Settings for the flags are automatically derived. SWAP_WITH_NEXT
is relevant for Thai and Lao sorts. REVERSE_SECONDARY
is for French sorts. CANONICAL_EQUIVALENCE
determines whether canonical rules will be used. In this example, CANONICAL_EQUIVALENCE
is checked.
The valid range for Collation ID (sort ID) for a user-defined sort is 1,000 to 2,000 for monolingual collation and 10,000 to 11,000 for multilingual collation.
See Also:
|
Figure 12-26 shows the Unicode Collation Sequence screen.
Text description of the illustration unicodec.gif
This example customizes the character set by moving digits so that they sort after letters. Complete the following steps:
x0034
Unicode value is highlighted. Its location in the Unicode Collation Sequence is called a node.Text description of the illustration pastenod.gif
Select the position and the level at which you want to paste the node.
In Figure 12-27, the After button and the Primary button are selected.
Use similar steps to move other digits to a position after the letters a
through z
.
Figure 12-28 shows the resulting Unicode Collation Sequence after the digits 0
through 4
were moved to a position after the letters a
through z
.
Text description of the illustration afterpas.gif
The rest of this section contains the following topics:
This example shows how to change the sort order for characters with diacritics. You can do this by changing the sort for all characters containing a particular diacritic or by changing one character at a time. This example changes the sort of all characters with a circumflex (for example, û
) to be after all characters containing a tilde.
Verify the current sort order by choosing Canonical Rules in the Tools menu. This opens the Canonical Rules dialog box, shown in Figure 12-29.
Text description of the illustration ex1.gif
Figure 12-29 shows how characters are decomposed into their canonical equivalents and their current sorting orders. For example, û
is represented as u
plus ^
.
See Also:
Chapter 4, "Linguistic Sorting" for more information about canonical rules |
In the main Oracle Locale Builder window, click the Non-Spacing Characters tab. If you use the Non-Spacing Characters screen, then changes for diacritics apply to all characters. Figure 12-30 shows the Non-Spacing Characters screen.
Text description of the illustration ex2.gif
Select the circumflex and click Cut. Click Yes in the Removal Confirmation dialog box. Select the tilde and click Paste. Choose After and Secondary in the Paste Node dialog box and click OK.
Figure 12-31 illustrates the new sort order.
Text description of the illustration ex3.gif
To change the order of a specific character with a diacritic, insert the character directly into the appropriate position. Characters with diacritics do not appear in the Unicode Collation screen, so you cannot cut and paste them into the new location.
This example changes the sort order for ä
so that it sorts after Z
.
Select the Unicode Collation tab. Highlight the character, Z,
that you want to put ä
next to. Click Add. The Insert New Node dialog box appears, as shown in Figure 12-32.
Text description of the illustration ex5.gif
Choose After and Primary in the Insert New Node dialog box. Enter the Unicode code point value of ä
. The code point value is \x00e4
. Click OK.
Figure 12-33 shows the resulting sort order.
Text description of the illustration ex4.gif
After you have defined a new language, territory, character set, or linguistic sort, generate new NLB files from the NLT files:
lx0boot.nlb
) and the NLS system boot file (lx1boot.nlb
) in the ORA_NLS33 directory. On a UNIX platform, enter commands similar to the following:
% cd $ORA_NLS33 % cp lx0boot.nlb lx0boot.nlb.orig % cp lx1boot.nlb lx1boot.nlb.orig
Text description of the illustration ex6.gif
Do not try to specify an NLT file. Oracle Locale Builder generates an NLB file for each NLT file.
Figure 12-35 illustrates the final notification that you have successfully generated NLB files for all NLT files in the directory.
lx1boot.nlb
file into the path that is specified by the ORA_NLS33
initialization parameter, typically $ORACLE_HOME/OCOMMON/nls/admin/data
. For example, on a UNIX platform, enter a command similar to the following:
% cp /directory_name
/lx1boot.nlb $ORA_NLS33/lx1boot.nlb
% cp /directory_name
/lx22710.nlb $ORA_NLS33 % cp /directory_name
/lx52710.nlb $ORA_NLA33
|
Copyright © 1996, 2002 Oracle Corporation. All Rights Reserved. |
|