aboutsummaryrefslogtreecommitdiffstats
path: root/lib/syntax_tools/src/erl_comment_scan.erl
diff options
context:
space:
mode:
authorMagnus Lidén <[email protected]>2014-07-02 09:59:15 +0200
committerMagnus Lidén <[email protected]>2014-07-02 09:59:15 +0200
commit3edf161fa05cb1b16d8d3f98c6666d9b71293535 (patch)
treeff18c236ae06984ddd2fcf758c001d8a59fc4522 /lib/syntax_tools/src/erl_comment_scan.erl
parenta6de62be5de44b249bc2d1c963c0c31bed5d32d0 (diff)
parentfbc5f26d8f00277aca13fd97a0eef2423446c249 (diff)
downloadotp-3edf161fa05cb1b16d8d3f98c6666d9b71293535.tar.gz
otp-3edf161fa05cb1b16d8d3f98c6666d9b71293535.tar.bz2
otp-3edf161fa05cb1b16d8d3f98c6666d9b71293535.zip
Merge branch 'maint'
Diffstat (limited to 'lib/syntax_tools/src/erl_comment_scan.erl')
-rw-r--r--lib/syntax_tools/src/erl_comment_scan.erl13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/syntax_tools/src/erl_comment_scan.erl b/lib/syntax_tools/src/erl_comment_scan.erl
index dae7530ce7..03429d4d42 100644
--- a/lib/syntax_tools/src/erl_comment_scan.erl
+++ b/lib/syntax_tools/src/erl_comment_scan.erl
@@ -72,13 +72,24 @@ file(Name) ->
{ok, V} ->
case V of
{ok, B} ->
- Enc = case epp:read_encoding(Name) of
+ Encoding = epp:read_encoding_from_binary(B),
+ Enc = case Encoding 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 when Encoding =:= none ->
+ case
+ catch unicode:characters_to_list(B, latin1)
+ of
+ String when is_list(String) ->
+ string(String);
+ _ ->
+ error_read_file(Name1),
+ exit(R)
+ end;
R ->
error_read_file(Name1),
exit(R)