Reprint: http://www.linuxidc.com/Linux/2008-02/11238.htm
The first few days after the OCI connected to the database problem, with the Oracle's own example test, can read the data (all in English), it is safe to go to develop other modules. These days to do the database module is the need to insert Chinese data, only to find that inserted into the "????". Make sure that the data is in GB2312 format and is still invalid after conversion to UTF-8. Turn over and over again, always not effective.
Google found an article on the client to set the CharSet Nls_lang, remember the previous installation of Oracle is an English installation, only set the LANG variable, this is not set. The Oracle server-side SELECT * from sys.props$
Nls_language=american
Nls_territory=america
Nls_iso_currency=america
Nls_characterset=zhs16gbk
Set the Nls_lang=american_america based on these parameters. ZHS16GBK (the Google out article is set to nls_lang= "simplified Chinese_china. ZHS16GBK ", because the character set settings for the installed server are different).
Then export Nls_lang=american_america in the/etc/profile. ZHS16GBK, then Source/etc/profile, and then run the program, Haha, Chinese came out Ah!
Linux under Occi operation Oracle Database, Chinese garbled problem