'perldoc Encode' states: > "UTF-8" means UTF-8 in its current sense, which is conservative and > strict and security-conscious, whereas "utf8" means UTF-8 in its > former sense, which was liberal and loose and lax.
Currently, the following callers use the $force_utf8 flag: 1. Notification config 2. The SDN fabrics config 3. The PBS password file The first two pass the contents to Rust, and the latter already uses the strict 'UTF-8' encoding when decoding. So in all cases, after this patch, any potential issues are just caught earlier, before writing. Signed-off-by: Fiona Ebner <[email protected]> --- src/PVE/File.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PVE/File.pm b/src/PVE/File.pm index 7d0f7ab..89884a8 100644 --- a/src/PVE/File.pm +++ b/src/PVE/File.pm @@ -60,7 +60,7 @@ sub file_set_contents($filename, $data, $perm = 0644, $force_utf8 = 0) { die "unable to open file '$tmpname' - $!\n" if !$fh; if ($force_utf8) { - $data = encode("utf8", $data); + $data = encode("UTF-8", $data); } else { # Encode wide characters with print before passing them to syswrite my $unencoded_data = $data; -- 2.47.3
