Locale setting
Posted in 2007
A user asked how DB_LOCALE, CLIENT_LOCALE and SERVER_LOCALE relate to the OS LANG variable, and later how to discover which locale an existing database uses. Answers: locale names take the form ll_tt.codeset; 'glfiles' lists available Informix locales; CLIENT_LOCALE should match the OS/terminal setting (LANG, via 'locale -a'), SERVER_LOCALE only affects oninit messages, and DB_LOCALE must match the database's creation locale. To find it, query sysmaster/sysdatabases (sysdbslocale) or use dbaccess Info > NLS; codeset values can be looked up in $INFORMIXDIR/gls/cm3/registry. Question answered.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: Internationalization & Character Sets
Hello, Need your help in understanding the locale setting on the informix machine. I am writing script that needs the CLIENT_LOCALE, DB_LOCALE and SERVER_LOCALE to be updated. Q are : 1. Is it correct to use the OS environment variable LANG and update all the above informix variable ? 2. Is there a mapping from the LANG setting to the informix locale settings ? like if LANG is set to "C" then can i make CLIENT_LOCALE=en .. 3. Can someone guide to the correct docs - setting the locale ? 4. On what OS parameters can the above informix variable can be set ? Is there a way to set the variable ? ~ Balu
Hi, The question is: what do you intend to do with setting the locale ? DB_LOCALE is the locale which the data is stored in. (It will override the value which the database was created with ! In case this is set to a wrong value which does not match your real data format, output can have ugly results, depending on the conversion which is performed). CLIENT_LOCALE is the locale which your client app wants to get as output. SERVER_LOCALE, I did not use this at any time. You should consult the documentation. The form is always language_country.charset. E.g. en_us.PC-Latin-1, de_de.8859-15. Consult the IDS Help for details: http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp In case these are set and have different content, IDS does the codeset conversion. There are other parameters like DBMONEY, DBDATE, which control the date/money format. E.g. setting CLIENT_LOCALE to en_us.8859-1 will give you ansi charset and american style dates etc. Setting DBDATE to DMY4 will return every date in DMY form (year 4 digits, separator /). Setting it to DMY4- will turn the separator to "-" (28-12-2006). Marcus -----Original Message----- From: BALU T [mailto:coolbalaga@rediffmail.com] Sent: Tuesday, February 20, 2007 1:43 PM To: ids@iiug.org Subject: Locale setting [8430] Hello, Need your help in understanding the locale setting on the informix machine. I am writing script that needs the CLIENT_LOCALE, DB_LOCALE and SERVER_LOCALE to be updated. Q are : 1. Is it correct to use the OS environment variable LANG and update all the above informix variable ? 2. Is there a mapping from the LANG setting to the informix locale settings ? like if LANG is set to "C" then can i make CLIENT_LOCALE=en .. 3. Can someone guide to the correct docs - setting the locale ? 4. On what OS parameters can the above informix variable can be set ? Is there a way to set the variable ? ~ Balu ************************************************************************ ******* Forum Note: Use "Reply" to post a response in the discussion forum.
Hi, in addition you can run a small utility called "glfiles" (just like that, no options required). It will produce a list with the names of the available (IBM Informix) locales - in a file named "lc11.txt" in the current directory. These names of locales can be used to set any of those three IBM Informix specific environment variables, DB_LOCALE, CLIENT_LOCALE, SERVER_LOCALE. Regards, Martin -- Martin Fuerderer IBM Informix Development Munich, Germany Information Management Sorry, but the following text is now required by German law: IBM Deutschland GmbH Vorsitzender des Aufsichtsrats: Hans Ulrich Maerki Geschäftsführung: Martin Jetter (Vorsitzender), Rudolf Bauer, Christian Diedrich, Christoph Grandpierre, Matthias Hartmann, Andreas Kerstan Sitz der Gesellschaft: Stuttgart Registergericht: Amtsgericht Stuttgart, HRB 14562 WEEE-Reg.-Nr. DE 99369940 ids-bounces@iiug.org wrote on 20.02.2007 13:58:53: > Hi, > > The question is: what do you intend to do with setting the locale ? > DB_LOCALE is the locale which the data is stored in. (It will override > the value which the database was created with ! In case this is set to a > wrong value which does not match your real data format, output can have > ugly results, depending on the conversion which is performed). > CLIENT_LOCALE is the locale which your client app wants to get as > output. > SERVER_LOCALE, I did not use this at any time. You should consult the > documentation. > The form is always language_country.charset. E.g. en_us.PC-Latin-1, > de_de.8859-15. > Consult the IDS Help for details: > http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp > > In case these are set and have different content, IDS does the codeset > conversion. > > There are other parameters like DBMONEY, DBDATE, which control the > date/money format. > E.g. setting CLIENT_LOCALE to en_us.8859-1 will give you ansi charset > and american style dates etc. > Setting DBDATE to DMY4 will return every date in DMY form (year 4 > digits, separator /). Setting it to DMY4- will turn the separator to "-" > (28-12-2006). > > Marcus > > -----Original Message----- > From: BALU T [mailto:coolbalaga@rediffmail.com] > Sent: Tuesday, February 20, 2007 1:43 PM > To: ids@iiug.org > Subject: Locale setting [8430] > > Hello, > > Need your help in understanding the locale setting on the informix > machine. > > I am writing script that needs the CLIENT_LOCALE, DB_LOCALE and > SERVER_LOCALE to be updated. > > Q are : > 1. Is it correct to use the OS environment variable LANG and update all > the above informix variable ? > 2. Is there a mapping from the LANG setting to the informix locale > settings ? > like if LANG is set to "C" then can i make CLIENT_LOCALE=en .. > 3. Can someone guide to the correct docs - setting the locale ? > 4. On what OS parameters can the above informix variable can be set ? > Is there a way to set the variable ? > > ~ Balu > > ************************************************************************ > Forum Note: Use "Reply" to post a response in the discussion forum.
> 1. Is it correct to use the OS environment variable LANG and update all
the
> above informix variable ?
NO,
CLIENT_LOCALE and the OS environment variable should be compatible
SERVER_LOCALE is only used by "oninit" and should be set
compatible to OS environment. (if you are expecting English logs there is
no real reason to set it).
DB_LOCALE should always be set to the value of DB_LOCALE set by
the client that created the database. (latest versions of IDS will not
allow connections if DB_LOCALE is set incorrectly)
Selecting a database locale is difficult, and involves looking at all
client environments and selecting the best match for all environments.
> 2. Is there a mapping from the LANG setting to the informix locale
settings ?
> like if LANG is set to "C" then can i make CLIENT_LOCALE=en ..
I didn't think any one used "C" any more, for this use "en_us.8859-1".
no, unfortunately the valid values of LANG are different form platform to
platform, and generally intuition will tell you the correct value.
ll_tt.codeset@modifer is the format of the environment variable
and relates to a file,
$INFORMIXDIR/gls/lc11/ll_tt/(hexvaluecodeset)(modifer).lco
hexvaluecodeset can be looked up in the file $INFORMIXDIR/gls/cm3/
registry from the valid values of codeset
> 4. On what OS parameters can the above informix variable can be set ?
> Is there a way to set the variable ?
I don't understand this question, so I will say on windows use setnet32
and on unix the same way you set any other environment variable.
~ Balu
*******************************************************************************
Forum Note: Use "Reply" to post a response in the discussion forum.
Hello, Thanks for the replies. My Q was : How can I know what the locale setting that is being used currently ? i.e., set the nondefault locale, <---- For example, to access a database with a Japanese SJIS locale, set both DB_LOCALE and CLIENT_LOCALE to ja_jp.sjis on the client system -----> For the above example, how can i know what locale the database is set ? Is there a command to run and get the details of the locale, and so that I can then assign the values to DB_LOCALE and CLIENT_LOCALE. ~ Balu
Hi Balu,
The following two ways help you in obtaining the locale setting
that is being used currently :
Method 1 : Enter "dbaccess" and select "sysmaster" database and then fire
the query " select * from sysdbslocale ; ". You will obtain the required
result.
Method 2: Enter " dbaccess" and select a database and choose " Info" on
the same menu. Then choose " Nls" to obtain the required output
Thanks,
Prasanna Alur Mathada
Primary Contact - Informix -Interoperability( INDIA)
India Software Lab, IBM Software Group
"BALU T" <coolbalaga@rediffmail.com>
Sent by: ids-bounces@iiug.org
21/02/2007 11:22
Please respond to
ids@iiug.org
To
ids@iiug.org
cc
Subject
Re: Locale setting [8458]
Hello,
Thanks for the replies.
My Q was :
How can I know what the locale setting that is being used currently ?
i.e., set the nondefault locale,
<----
For example, to access a database with a Japanese SJIS locale, set both
DB_LOCALE and CLIENT_LOCALE to ja_jp.sjis on the client system
----->
For the above example, how can i know what locale the database is set ?
Is there a command to run and get the details of the locale, and so that I
can
then assign the values to DB_LOCALE and CLIENT_LOCALE.
~ Balu
*******************************************************************************
Forum Note: Use "Reply" to post a response in the discussion forum.
Hi, You can get the locale of the database by querying sysmaster:sysdatabases for the locale of the db you want to access. The locale stored there might be a synonym of the original value. This is the locale which was used when the database was created. It is not necessarily the locale in which the data is stored (but probably the correct value). If you set DB_LOCALE to a different value when entering data, the database ignores the value from sysdatabases. As I said before, you should not have a need to set DB_LOCALE in case the data is stored in the same locale as the database was created with. Though, it does not harm. Marcus -----Original Message----- From: BALU T [mailto:coolbalaga@rediffmail.com] Sent: Wednesday, February 21, 2007 6:53 AM To: ids@iiug.org Subject: Re: Locale setting [8458] Hello, Thanks for the replies. My Q was : How can I know what the locale setting that is being used currently ? i.e., set the nondefault locale, <---- For example, to access a database with a Japanese SJIS locale, set both DB_LOCALE and CLIENT_LOCALE to ja_jp.sjis on the client system -----> For the above example, how can i know what locale the database is set ? Is there a command to run and get the details of the locale, and so that I can then assign the values to DB_LOCALE and CLIENT_LOCALE. ~ Balu ************************************************************************ ******* Forum Note: Use "Reply" to post a response in the discussion forum.
Prasanna and Marcus, have told you how to get the correct DB_LOCALE value, and will be of the form ll_tt.codeset. where codeset is the decimal value of the codeset which can be looked up in the registry file (see my mail yesterday). (comment on Marcus's mail) If you set DB_LOCALE to a different value when entering data, the database doesn't ignore the value from sysdatabases. "server uses the value form sysdatabases" Client will use the value set in environment. later versions of IDS will throw an error if the value of DB_LOCALE is not compatible with the "database locale" (less important for Latin 1 locales) For setting CLIENT_LOCALE, On Solaris 9 (locale -a is standard for all *nix platforms that I know) locale -a | grep ja, ja #equlivant to ja_jp.ujis ja_JP.PCK #equlivant to ja_jp.sjis-s ja_JP.UTF-8 #equlivant to ja_jp.utf8 ja_JP.eucJP #equlivant to ja_jp.ujis Set LANG to the OS equlivant of CLIENT_LOCALE. You also must use the correct font in the terminal that you are using (i.e. one compatible with the value of CLIENT_LOCALE), I use the following cmd on Linux to use utf8 in an xterm (so check the man pages for the terminal and xserver, window manager that you are using) the last 2 elements of the font name relate to code set used by that font (xfontsel is what I use to see what x fonts are installed.) xterm \\\\ -fb "-misc-fixed-medium-r-*-*-*-*-*-*-*-*-iso646.1991-*" \\\\ -fi "-misc-fixed-medium-r-*-*-*-*-*-*-*-*-iso646.1991-*" \\\\ -fn "-misc-fixed-medium-r-*-*-*-*-*-*-*-*-iso646.1991-*" \\\\ -fw "-misc-fixed-medium-r-*-*-*-*-*-*-*-*-iso646.1991-*" \\\\ -fwb "-misc-fixed-medium-r-*-*-*-*-*-*-*-*-iso646.1991-*" \\\\ -fx "-misc-fixed-medium-r-*-*-*-*-*-*-*-*-iso646.1991-*" normally ja_jp.sjis is only used as a DB_LOCALE when some clients set client_locale to ja_jp.ujis and others to ja_jp.sjis-s as ja_jp.sjis should provide round trip codeset conversion for both these locales. "BALU T" <coolbalaga@rediffmail.com> Sent by: ids-bounces@iiug.org 02/21/2007 12:52 AM Please respond to ids@iiug.org To ids@iiug.org cc Subject Re: Locale setting [8458] Hello, Thanks for the replies. My Q was : How can I know what the locale setting that is being used currently ? i.e., set the nondefault locale, <---- For example, to access a database with a Japanese SJIS locale, set both DB_LOCALE and CLIENT_LOCALE to ja_jp.sjis on the client system -----> For the above example, how can i know what locale the database is set ? Is there a command to run and get the details of the locale, and so that I can then assign the values to DB_LOCALE and CLIENT_LOCALE. ~ Balu ******************************************************************************* Forum Note: Use "Reply" to post a response in the discussion forum.