]> git.proxmox.com Git - pve-common.git/blobdiff - data/PVE/Tools.pm
new helper decode_utf8_parameters()
[pve-common.git] / data / PVE / Tools.pm
index 72494027a1e937b310c1fe7515d6e10f93d8d81b..dc4bbfd33f7269739dfe5ff18fe99a9098acbbdc 100644 (file)
@@ -727,6 +727,16 @@ sub decode_text {
     return Encode::decode("utf8", uri_unescape($data));
 }
 
     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());
 sub random_ether_addr {
 
     my $rand = Digest::SHA1::sha1_hex(rand(), time());