Search code examples
oracleencodingutf-8internationalizationglobalization

choosing NLS_LANG for Oracle


According to the site, http://www.dba-oracle.com/t_nls_lang.htm

Problem might occur even if both the database and the client use the same characterset(AL32UTF8). I couldn't understand how this can be possible. Quoting from the site:

For example, suppose that the database character set is AL32UTF8, the client is an English Windows operating system, and the NLS_LANG setting on the client is AL32UTF8. Data coming into the database is encoded in WE8MSWIN1252 and is not converted to AL32UTF8 data because the NLS_LANG setting on the client matches the database character set. Thus Oracle assumes that no conversion is necessary, and invalid data is entered into the database.

How can the data be coming as WE8MSIN1252 into the database when the encoding in the client is AL32UTF8?.


Solution

  • Because OS itself using other character set (WE8MSIN1252 in this case). But since NLS_LANG (on client) is set to AL32UTF8, Oracle does not know about this. Oracle always uses value in NLS_LANG and ignores system settings, while (almost) all other software uses OS settings.

    So, to fix this problem, local (client) NLS_LANG must be the same as OS character set. Or (other option) software running on client must reencode characters by itself.