diff options
author | Hans Bolinder <[email protected]> | 2012-12-03 12:38:07 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2013-01-02 10:15:17 +0100 |
commit | 0dcd574b493daa864e22a8332d11be9945466cb6 (patch) | |
tree | be495db057f1e2a2969e60fa3d8c0d1390b476a3 /lib/syntax_tools/src/erl_tidy.erl | |
parent | 7f00144160c8e0202cfe7368830bdd472bc73505 (diff) | |
download | otp-0dcd574b493daa864e22a8332d11be9945466cb6.tar.gz otp-0dcd574b493daa864e22a8332d11be9945466cb6.tar.bz2 otp-0dcd574b493daa864e22a8332d11be9945466cb6.zip |
[syntax_tools] Introduce Unicode support for Erlang source files
Not complete.
Unicode in wild attribute doesn't work.
No support for Unicode regarding Igor stubs.
Diffstat (limited to 'lib/syntax_tools/src/erl_tidy.erl')
-rw-r--r-- | lib/syntax_tools/src/erl_tidy.erl | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/syntax_tools/src/erl_tidy.erl b/lib/syntax_tools/src/erl_tidy.erl index 59cf6c0a92..e9a88caff3 100644 --- a/lib/syntax_tools/src/erl_tidy.erl +++ b/lib/syntax_tools/src/erl_tidy.erl @@ -375,6 +375,8 @@ write_module(Tree, Name, Opts) -> end, filename(filename:join(Dir, Name1)) end, + Encoding = [{encoding,Enc} || Enc <- [epp:read_encoding(Name)], + Enc =/= none], case proplists:get_bool(backups, Opts) of true -> backup_file(File, Opts); @@ -382,9 +384,9 @@ write_module(Tree, Name, Opts) -> ok end, Printer = proplists:get_value(printer, Opts), - FD = open_output_file(File), + FD = open_output_file(File, Encoding), verbose("writing to file `~s'.", [File], Opts), - V = (catch {ok, output(FD, Printer, Tree, Opts)}), + V = (catch {ok, output(FD, Printer, Tree, Opts++Encoding)}), ok = file:close(FD), case V of {ok, _} -> @@ -432,8 +434,9 @@ file_type(Name, Links) -> throw(R) end. -open_output_file(FName) -> - case catch file:open(FName, [write]) of +open_output_file(FName, Options) -> +io:format("Options ~p~n", [Options]), + case catch file:open(FName, [write]++Options) of {ok, FD} -> FD; {error, R} -> |