Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: ModPerl

Perl + DBD-Oracle, problems with encoding when "PerlHandler Apache::Registry" is in use

 

 

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded


kornerr at gmail

Feb 19, 2010, 2:47 AM

Post #1 of 2 (687 views)
Permalink
Perl + DBD-Oracle, problems with encoding when "PerlHandler Apache::Registry" is in use

Hello.
Here's a short script I used to find out the problem with the Apache::Registry:

#!/usr/bin/perl -wT
use strict;
use warnings;
use CGI;
use DBI;
use DBI qw(:sql_types);
use encoding 'utf-8';

my $cgi = new CGI;
print $cgi->header(-type    => "text/html",
                  -charset => "utf-8");
print $cgi->start_html(-lang => "ru-RU",
                      -title => "Title");
print $cgi->h1("Title");
my $db = DBI->connect("DBI:Oracle:SID=ELTC;HOST=10.102.101.4",
                     <username>, <userpassword>, {RaiseError => 1,
                                                AutoCommit => 0,
                                                ora_charset => "UTF8"});
my $query = "select name from swmgr2.vw_switches where sw_id_ip =
2315046666"; // Selects Russian "name" from DB in UTF-8, because on
the previouse line we asked Oracle to return data to us in UTF-8.
my $stmt = $db->prepare($query);
$stmt->execute();
my $name;
$stmt->bind_columns(undef, \$name);
$stmt->fetch();
$stmt->finish();
$db->disconnect();
print $cgi->p($name);
print $cgi->end_html();

When invoked directly by the shell or in web page WITHOUT "PerlHandler
Apache::Registry", the UTF-8 encoded string in Russian is printed just
fine. But when "PerlHandler Apache::Registry" is used, only ???? are
printed in web page.
Thanks.


pharkins at gmail

Feb 19, 2010, 8:33 AM

Post #2 of 2 (648 views)
Permalink
Re: Perl + DBD-Oracle, problems with encoding when "PerlHandler Apache::Registry" is in use [In reply to]

On Fri, Feb 19, 2010 at 5:47 AM, michael kapelko <kornerr [at] gmail> wrote:
> When invoked directly by the shell or in web page WITHOUT "PerlHandler
> Apache::Registry", the UTF-8 encoded string in Russian is printed just
> fine. But when "PerlHandler Apache::Registry" is used, only ???? are
> printed in web page.

Check your headers. See if there's any difference in the headers sent
when this is run with Registry.

- Perrin

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.