sub template_replace {
my ($tmpl, $data) = @_;
+ return $tmpl if !$tmpl;
+
my $res = '';
while ($tmpl =~ m/([^{]+)?({([^}]+)})?/g) {
$res .= $1 if $1;
return Encode::decode("utf8", uri_unescape($data));
}
+sub decode_utf8_parameters {
+ my ($param) = @_;
+
+ foreach my $p (qw(comment description firstname lastname)) {
+ $param->{$p} = decode('utf8', $param->{$p}) if $param->{$p};
+ }
+
+ return $param;
+}
+
sub random_ether_addr {
my $rand = Digest::SHA1::sha1_hex(rand(), time());