]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - config/cfgroot/general-functions.pl
Increase performance of the squidclamav redirector.
[people/teissler/ipfire-2.x.git] / config / cfgroot / general-functions.pl
index 90eacbdb011487e2f4af8e60eb8cc42e249f3620..fbca601e4a62e2e31febfe24f66128b16d4335e4 100644 (file)
@@ -1008,4 +1008,27 @@ sub MakeUserAgent() {
        return $user_agent;
 }
 
+# Function to read a file with UTF-8 charset.
+sub read_file_utf8 ($) {
+       my ($file) = @_;
+
+       open my $in, '<:encoding(UTF-8)', $file or die "Could not open '$file' for reading $!";
+       local $/ = undef;
+       my $all = <$in>;
+       close $in;
+
+       return $all;    
+}
+
+# Function to write a file with UTF-8 charset.
+sub write_file_utf8 ($) {
+       my ($file, $content) = @_;
+
+       open my $out, '>:encoding(UTF-8)', $file or die "Could not open '$file' for writing $!";;           
+       print $out $content;
+       close $out;
+
+       return; 
+}
+
 1;