[pmg-devel] applied: [PATCH pmg-api] disclaimer: encode/decode utf8 content

Dietmar Maurer dietmar at proxmox.com
Mon Jun 25 14:20:07 CEST 2018


applied

> On June 25, 2018 at 12:18 PM Dominik Csapak <d.csapak at proxmox.com> wrote:
> 
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  PMG/RuleDB/Disclaimer.pm | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/PMG/RuleDB/Disclaimer.pm b/PMG/RuleDB/Disclaimer.pm
> index e64adb9..9f0546e 100644
> --- a/PMG/RuleDB/Disclaimer.pm
> +++ b/PMG/RuleDB/Disclaimer.pm
> @@ -8,7 +8,7 @@ use HTML::Parser;
>  use HTML::Entities;
>  use MIME::Body;
>  use IO::File;
> -use Encode;
> +use Encode qw(decode encode);
>  
>  use PMG::Utils;
>  use PMG::ModGroup;
> @@ -67,7 +67,7 @@ sub load_attr {
>  
>      defined($value) || die "undefined object attribute: ERROR";
>    
> -    my $obj = $class->new($value, $ogroup);
> +    my $obj = $class->new(decode('UTF-8', $value), $ogroup);
>  
>      $obj->{id} = $id;
>  
> @@ -87,7 +87,7 @@ sub save {
>  	
>  	$ruledb->{dbh}->do(
>  	    "UPDATE Object SET Value = ? WHERE ID = ?", 
> -	    undef, $self->{value}, $self->{id});
> +	    undef, encode('UTF-8', $self->{value}), $self->{id});
>  
>      } else {
>  	# insert
> @@ -96,7 +96,7 @@ sub save {
>  	    "INSERT INTO Object (Objectgroup_ID, ObjectType, Value) " .
>  	    "VALUES (?, ?, ?);");
>  
> -	$sth->execute($self->ogroup, $self->otype, $self->{value});
> +	$sth->execute($self->ogroup, $self->otype, encode('UTF-8', $self->{value}));
>      
>  	$self->{id} = PMG::Utils::lastid($ruledb->{dbh}, 'object_id_seq'); 
>      }
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> pmg-devel mailing list
> pmg-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel



More information about the pmg-devel mailing list