-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Item13653: Support Foswiki 2 (Unicode)
- Loading branch information
Showing
3 changed files
with
91 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Wrapper for DB_File::Lock, based on the very same | ||
# Transparently handles Unicode strings by storing them as UTF-8 | ||
# (for some reason the perldbmfilter(1) approach doesn't work) | ||
package Foswiki::Contrib::LdapContrib::DBFileLockConvert; | ||
|
||
use strict; | ||
use vars qw($VERSION @ISA); | ||
|
||
@ISA = 'DB_File::Lock'; | ||
$VERSION = '0.01'; | ||
|
||
use DB_File::Lock (); | ||
|
||
sub FETCH { | ||
my ($self, $key) = @_; | ||
my $res = $self->SUPER::FETCH(Foswiki::encode_utf8($key)); | ||
return $res unless defined $res; | ||
Foswiki::decode_utf8($res); | ||
} | ||
|
||
sub STORE { | ||
my ($self, $key, $value) = @_; | ||
$self->SUPER::STORE(Foswiki::encode_utf8($key), Foswiki::encode_utf8($value)); | ||
} | ||
|
||
sub DELETE { | ||
my ($self, $key) = @_; | ||
my $res = $self->SUPER::DELETE(Foswiki::encode_utf8($key)); | ||
return $res unless defined $res; | ||
Foswiki::decode_utf8($res); | ||
} | ||
|
||
sub EXISTS { | ||
my ($self, $key) = @_; | ||
$self->SUPER::EXISTS(Foswiki::encode_utf8($key)); | ||
} | ||
|
||
sub FIRSTKEY { | ||
my $self = shift; | ||
map { defined $_ ? Foswiki::decode_utf8($_) : $_ } $self->SUPER::FIRSTKEY(); | ||
} | ||
|
||
sub NEXTKEY { | ||
my ($self, $lastkey) = @_; | ||
map { defined $_ ? Foswiki::decode_utf8($_) : $_ } $self->SUPER::NEXTKEY($lastkey); | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters