Opened 14 years ago

Closed 13 years ago

#24 closed defect (fixed)

undefined charset if dbh is passed to new storage

Reported by: Dominic Hargreaves Owned by: Dominic Hargreaves
Priority: normal Milestone:
Component: wiki-toolkit Version: svn
Keywords: hackfestsummer2007-reviewed Cc:

Description (last modified by Dominic Hargreaves)

[from http://rt.cpan.org/Public/Bug/Display.html?id=26761]

Wiki::Toolkit::Store::Pg->new( dbh => $dbh, charset => 'utf-8' );

In the above code, if you either specify charset or not it is ignored and undefined so charset_encode/charset_decode functions don't have anything to work with.

This is the chage i've made to Wiki::Toolkit::Store::Database version 0.27 as a quick fix. I'm not sure if this is the best fix though.

if ( $args{dbh} ) {
$self->{_dbh} = $args{dbh};
$self->{_external_dbh} = 1; # don't disconnect at DESTROY time
+ $self->{_charset} = $args{charset} || "iso-8859-1";
} else {
die "Must supply a dbname" unless defined $args{dbname};

Thank you.

Change History (7)

comment:1 Changed 14 years ago by Dominic Hargreaves

Code should have been:

if ( $args{dbh} ) {
$self->{_dbh} = $args{dbh};
$self->{_external_dbh} = 1; # don't disconnect at DESTROY time
+ $self->{_charset} = $args{charset} || "iso-8859-1";
} else {
die "Must supply a dbname" unless defined $args{dbname};

comment:2 Changed 14 years ago by Dominic Hargreaves

Owner: changed from nick to Nobody

comment:3 Changed 14 years ago by ilmari

Keywords: hackfestsummer2007-reviewed added
Owner: changed from Nobody to ilmari
Status: newassigned

comment:4 Changed 13 years ago by Dominic Hargreaves

Description: modified (diff)

comment:5 Changed 13 years ago by Dominic Hargreaves

Owner: changed from ilmari to Dominic Hargreaves
Status: assignednew

comment:6 Changed 13 years ago by Dominic Hargreaves

Status: newassigned

comment:7 Changed 13 years ago by Dominic Hargreaves

Resolution: fixed
Status: assignedclosed

(In [481]) Configure charset correctly when passing in an existing $dbh (fixes #24)

Note: See TracTickets for help on using tickets.