aboutsummaryrefslogtreecommitdiffstats
path: root/lib/syntax_tools/src/epp_dodger.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2012-12-03 12:38:07 +0100
committerHans Bolinder <[email protected]>2013-01-02 10:15:17 +0100
commit0dcd574b493daa864e22a8332d11be9945466cb6 (patch)
treebe495db057f1e2a2969e60fa3d8c0d1390b476a3 /lib/syntax_tools/src/epp_dodger.erl
parent7f00144160c8e0202cfe7368830bdd472bc73505 (diff)
downloadotp-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/epp_dodger.erl')
-rw-r--r--lib/syntax_tools/src/epp_dodger.erl4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/syntax_tools/src/epp_dodger.erl b/lib/syntax_tools/src/epp_dodger.erl
index b3ced34c14..70395848a1 100644
--- a/lib/syntax_tools/src/epp_dodger.erl
+++ b/lib/syntax_tools/src/epp_dodger.erl
@@ -186,6 +186,7 @@ quick_parse_file(File, Options) ->
parse_file(File, Parser, Options) ->
case file:open(File, [read]) of
{ok, Dev} ->
+ _ = epp:set_encoding(Dev),
try Parser(Dev, 1, Options)
after ok = file:close(Dev)
end;
@@ -400,7 +401,7 @@ quick_parse_form(Dev, L0, Options) ->
parse_form(Dev, L0, Parser, Options) ->
NoFail = proplists:get_bool(no_fail, Options),
Opt = #opt{clever = proplists:get_bool(clever, Options)},
- case io:scan_erl_form(Dev, "", L0) of
+ case io:scan_erl_form(Dev, "", L0, [unicode]) of
{ok, Ts, L1} ->
case catch {ok, Parser(Ts, Opt)} of
{'EXIT', Term} ->
@@ -419,6 +420,7 @@ parse_form(Dev, L0, Parser, Options) ->
{ok, F, L1}
end;
{error, _IoErr, _L1} = Err -> Err;
+ {error, _Reason} -> {eof, L0}; % This is probably encoding problem
{eof, _L1} = Eof -> Eof
end.