[pve-devel] [PATCH common 1/3] INotify.pm: add binmode utf8 to read/update_file

Dominik Csapak d.csapak at proxmox.com
Fri Aug 24 12:34:07 CEST 2018


this reads utf8 characters from files correctly

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/PVE/INotify.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
index 6892b4c..50a1a76 100644
--- a/src/PVE/INotify.pm
+++ b/src/PVE/INotify.pm
@@ -167,7 +167,8 @@ sub update_file {
     my $code = sub {
 
 	$fd = IO::File->new ($filename, "r");
-	
+	$fd->binmode(':utf8');
+
 	my $new = &$update($filename, $fd, $data, @args);
 
 	if (defined($new)) {
@@ -232,6 +233,7 @@ sub read_file {
     } else {
 	$fd = IO::File->new ($filename, "r");
     }
+    $fd->binmode(':utf8');
 
     my $acp = $ccinfo->{always_call_parser};
 
-- 
2.11.0





More information about the pve-devel mailing list