Skip to content

Commit

Permalink
Item13122: converts UTF-8 db-result to local Foswiki charset
Browse files Browse the repository at this point in the history
  • Loading branch information
prmdhost authored and gac410 committed Nov 28, 2014
1 parent e0d7ba7 commit 2ba7356
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/Foswiki/Store/QueryAlgorithms/DBIStoreContrib.pm
Expand Up @@ -194,7 +194,11 @@ sub query {
my $topicSet = [];
my $sth = Foswiki::Contrib::DBIStoreContrib::query($sql);
while ( my @row = $sth->fetchrow_array() ) {
push( @$topicSet, "$row[0]/$row[1]" );
my $_web = _convertFromUTF8( $row[0] );
my $_name = _convertFromUTF8( $row[1] );
Foswiki::Func::writeDebug("Decoded: " . $_web . " / " . $_name . " from UTF8 to " . $Foswiki::cfg{Site}{CharSet})
if MONITOR;
push( @$topicSet, "$_web/$_name" );
}

my $filter = getOptionFilter($options);
Expand Down Expand Up @@ -257,6 +261,13 @@ sub query {
return $this->addPager( $resultset, $options );
}

sub _convertFromUTF8 {
my $text = shift;
$text = Encode::decode( 'utf-8', $text );
$text = Encode::encode( $Foswiki::cfg{Site}{CharSet}, $text );
return $text;
}

# Expand web and topic limits to SQL expressions that can be
# appended to the end of the WHERE clause for the search.
sub _expand_arguments {
Expand Down

0 comments on commit 2ba7356

Please sign in to comment.