[pve-devel] [PATCH common v2 1/3] decode comments in /etc/network/interfaces as utf8

Dietmar Maurer dietmar at proxmox.com
Mon Sep 10 12:06:01 CEST 2018


you also need to encode on writing

> On September 5, 2018 at 10:54 AM Dominik Csapak <d.csapak at proxmox.com> wrote:
> 
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> changes from v1:
> * new in v2
>  src/PVE/INotify.pm | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
> index 6892b4c..f17f4c5 100644
> --- a/src/PVE/INotify.pm
> +++ b/src/PVE/INotify.pm
> @@ -868,10 +868,9 @@ sub __read_etc_network_interfaces {
>  	    while (defined ($line = <$fh>)) {
>  		chomp $line;
>  		if ($line =~ m/^\s*#(.*?)\s*$/) {
> -		    # NOTE: we use 'comments' instead of 'comment' to 
> -		    # avoid automatic utf8 conversion
>  		    $f->{comments} = '' if !$f->{comments};
> -		    $f->{comments} .= "$1\n";
> +		    my $comment = decode('UTF-8', $1);
> +		    $f->{comments} .= "$comment\n";
>  		} elsif ($line =~ m/^\s*(?:iface\s
>                                            |mapping\s
>                                            |auto\s
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




More information about the pve-devel mailing list