summaryrefslogtreecommitdiff
path: root/ikiwiki
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-04-04 19:34:50 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-04-04 19:34:50 +0000
commitf50bd57bcebe08d26653299b189fe82beaea4a0f (patch)
treeabf11303982b8a1780667696347e554c55c6d907 /ikiwiki
parenta0321594fb72ab1d215204f1838d2593e0b24f95 (diff)
proper binmode settings so that with -CSD, ikiwiki will support unicode
however, due to robustness, that's not enabled by default yet
Diffstat (limited to 'ikiwiki')
-rwxr-xr-xikiwiki10
1 files changed, 7 insertions, 3 deletions
diff --git a/ikiwiki b/ikiwiki
index 97afa853f..6bf58017d 100755
--- a/ikiwiki
+++ b/ikiwiki
@@ -193,24 +193,27 @@ sub srcfile ($) { #{{{
error("internal error: $file cannot be found");
} #}}}
-sub readfile ($) { #{{{
+sub readfile ($;$) { #{{{
my $file=shift;
+ my $binary=shift;
if (-l $file) {
error("cannot read a symlink ($file)");
}
local $/=undef;
- open (IN, "$file") || error("failed to read $file: $!");
+ open (IN, $file) || error("failed to read $file: $!");
+ binmode(IN) if $binary;
my $ret=<IN>;
close IN;
return $ret;
} #}}}
-sub writefile ($$$) { #{{{
+sub writefile ($$$;$) { #{{{
my $file=shift; # can include subdirs
my $destdir=shift; # directory to put file in
my $content=shift;
+ my $binary=shift;
my $test=$file;
while (length $test) {
@@ -232,6 +235,7 @@ sub writefile ($$$) { #{{{
}
open (OUT, ">$destdir/$file") || error("failed to write $destdir/$file: $!");
+ binmode(OUT) if $binary;
print OUT $content;
close OUT;
} #}}}