]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki.pm
* -CSD does not affect modules, so readfile() was not using the utf-8 input
[ikiwiki.git] / IkiWiki.pm
index 357c1cd2d0ed0567538b41d585f7483d86238847..76472302e12a9bce6c3989e90969399184a9cafd 100644 (file)
@@ -163,7 +163,12 @@ sub readfile ($;$) { #{{{
        
        local $/=undef;
        open (IN, $file) || error("failed to read $file: $!");
-       binmode(IN) if $binary;
+       if (! $binary) {
+               binmode(IN, ":utf8");
+       }
+       else {
+               binmode(IN);
+       }
        my $ret=<IN>;
        close IN;
        return $ret;
@@ -195,7 +200,12 @@ sub writefile ($$$;$) { #{{{
        }
        
        open (OUT, ">$destdir/$file") || error("failed to write $destdir/$file: $!");
-       binmode(OUT) if $binary;
+       if (! $binary) {
+               binmode(OUT, ":utf8");
+       }
+       else {
+               binmode(OUT);
+       }
        print OUT $content;
        close OUT;
 } #}}}