in reply to A puzzled garbage character issues by use Perl-DBI
If you mean Unicode with "Asian character", make sure every component knows that you are using Unicode. Perl should set the utf8-Flag on all strings containing Unicode, the DBI driver should know that your data may contain Unicode both while storing and while fetching, and your database should know that as well.
- DBD::Pg has the pg_enable_utf8 connect attribute
- DBD::ODBC must be compiled to support Unicode (default on on Win32, default off on any other platform)
- DBD::Oracle needs Environment variables (NLS_NCHAR=AL32UTF8) and at least Oracle 9.2
- DBD::mysql has mysql_enable_utf8
The Unicode setup of the database is very different from RDBMS to RDBMS. Oracle and PostgreSQL store Unicode in any CHAR or VARCHAR/VARCHAR2, MS SQL Server needs NVARCHAR or NCHAR instead of VARCHAR or CHAR, and MySQL -- I don't know. I prefer RDBMSes with less surprises.
See also the tests t/40UnicodeRoundTrip.t and t/41Unicode.t in DBD::ODBC
Alexander
--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: A puzzled garbage character issues by use Perl-DBI
by pysome (Scribe) on Jun 18, 2009 at 02:31 UTC |
In Section
Seekers of Perl Wisdom