Let me chime in here as well. Though I rarely ever use UTF but I beleive you
can set and or override any of the ENV values
this at the handle level which I think is the best solution to the orginal
problem
>From the POD
ora_charset, ora_ncharset
For oracle versions >= 9.2 you can specify the client charset and ncharset with
the ora_charset and ora_ncharset attributes. You still need to pass ora_envhp =
0 for all but the first connect.
These attributes override the settings from environment variables. $dbh =
DBI->connect ($dsn, $user, $passwd,
{ora_charset => 'AL32UTF8'});
Never use the stuff so I may be way off base.
Cheers
and Happy Christmass
> Date: Fri, 23 Dec 2011 11:08:31 +0000
> From: [email protected]
> To: [email protected]
> CC: [email protected]; [email protected]
> Subject: Re: [DBI-Users] Fwd: Problem to get UTF8-CSV-File
>
> On 22/12/11 20:40, Bill Ward wrote:
> > Agreed. Any Oracle initialization environment variables need to be set
> > before your Perl script starts. Another approach is to set them and then
> > re-exec() from within the script ... though be careful to avoid infinitely
> > re-execing the same script!
>
> This is not correct. With the script as written, no Oracle related code
> is executed until connect time, so enviroment variables which are interpreted
> by Oracle can be set any time before the first connect.
>
> On the other hand, variables interpreted by the run-time loader, such as
> LD_LIBRARY_PATH, must be set before perl itself is loaded. So, re-execing
> is necessary for a change to LD_LIBRARY_PATH, but not, but not for a
> change of NLS_LANG.
>
> >> hello ralf
> >> hello jens
> >>
> >> Jens Rehsack schrieb:
> >> [...]
> >>
> >> We have a problem. We want to get an UTF8-CSV-File from
> >>> UTF8-Oracle-Database. It seems to be that the CSV-File is always charset
> >>> "latin-1". What can we do to get UTF-8-File?
> >>> Here is our Testscript.
> >>>
> >>> #------ our Testscript--------------------**----#
> >>> #!/usr/local/bin/perl -w -C64 use strict;
> >>>
> >> [...]
> >>
> >>> $ENV{NLS_LANG}="GERMAN_**GERMANY.AL32UTF8";
> >>>
> >> [...]
> >>
> >> I seem to remember that it's to late for the oracle-client libraries to
> >> set NLS_LANG here inside the script - I guess at this time they are loaded
> >> already and have finished initializing their charset, thus ignoring any
> >> change in NLS_LANG.
> >>
> >> try to set NLS_LANG before starting the script. either by "export"ing it
> >> or by doing
> >>
> >> NLS_LANG="GERMAN_GERMANY.**AL32UTF8" ./your-test-script
> >>
> >> greetings
> >> hermann
> >>
> >
> >
> >
>
>
> --
> Charles Jardine - Computing Service, University of Cambridge
> [email protected] Tel: +44 1223 334506, Fax: +44 1223 334679