aboutsummaryrefslogtreecommitdiffstats
path: root/lib/syntax_tools/src/erl_comment_scan.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/erl_comment_scan.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/erl_comment_scan.erl')
-rw-r--r--lib/syntax_tools/src/erl_comment_scan.erl12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/syntax_tools/src/erl_comment_scan.erl b/lib/syntax_tools/src/erl_comment_scan.erl
index b833e1c069..a70e7ba413 100644
--- a/lib/syntax_tools/src/erl_comment_scan.erl
+++ b/lib/syntax_tools/src/erl_comment_scan.erl
@@ -72,7 +72,17 @@ file(Name) ->
{ok, V} ->
case V of
{ok, B} ->
- string(binary_to_list(B));
+ Enc = case epp:read_encoding(Name) of
+ none -> epp:default_encoding();
+ Enc0 -> Enc0
+ end,
+ case catch unicode:characters_to_list(B, Enc) of
+ String when is_list(String) ->
+ string(String);
+ R ->
+ error_read_file(Name1),
+ exit(R)
+ end;
{error, E} ->
error_read_file(Name1),
exit({read, E})