From 90c824bafe59c484a84403d09cad3a66723bd2cb Mon Sep 17 00:00:00 2001 From: Lukas Wagner Date: Wed, 30 Aug 2023 14:37:53 +0200 Subject: [PATCH 1/1] cluster fs: allow to force UTF-8 encoding for cfs_write_file Since this function is used to store utf8-encoded strings that come from Rust, we need to be able to save the file in proper utf8 encoding as well. Signed-off-by: Lukas Wagner [FE: use flag parameter instead of encoding as a string] Signed-off-by: Fiona Ebner --- src/PVE/Cluster.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PVE/Cluster.pm b/src/PVE/Cluster.pm index e3705b6..cfa2583 100644 --- a/src/PVE/Cluster.pm +++ b/src/PVE/Cluster.pm @@ -578,7 +578,7 @@ sub cfs_read_file { } sub cfs_write_file { - my ($filename, $data) = @_; + my ($filename, $data, $force_utf8) = @_; my ($version, $info) = cfs_file_version($filename); @@ -592,7 +592,7 @@ sub cfs_write_file { $ci->{version} = undef; } - PVE::Tools::file_set_contents($fsname, $raw); + PVE::Tools::file_set_contents($fsname, $raw, undef, 1); } my $cfs_lock = sub { -- 2.39.2