From 01252ecce4b8019c7d281b672711eee882137dc2 Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Sat, 29 Aug 2015 04:55:45 +0000 Subject: Use raw bytestream when writing files This patch forces write_file_if_contents_differ/2 to use raw bytes as when writing files. This fixes an issue where UTF-8 characters are processed and written back as ISO-8859-1 into the file, which makes it impossible to use UTF-8 characters in .app.src files. --- src/rebar_file_utils.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rebar_file_utils.erl b/src/rebar_file_utils.erl index 2f39b96..732d83f 100644 --- a/src/rebar_file_utils.erl +++ b/src/rebar_file_utils.erl @@ -201,9 +201,9 @@ write_file_if_contents_differ(Filename, Bytes) -> {ok, ToWrite} -> ok; {ok, _} -> - file:write_file(Filename, ToWrite); + file:write_file(Filename, ToWrite, [raw]); {error, _} -> - file:write_file(Filename, ToWrite) + file:write_file(Filename, ToWrite, [raw]) end. %% returns an os appropriate tmpdir given a path -- cgit v1.1