diff options
author | Magnus Lidén <[email protected]> | 2014-07-02 09:59:15 +0200 |
---|---|---|
committer | Magnus Lidén <[email protected]> | 2014-07-02 09:59:15 +0200 |
commit | 3edf161fa05cb1b16d8d3f98c6666d9b71293535 (patch) | |
tree | ff18c236ae06984ddd2fcf758c001d8a59fc4522 /lib/syntax_tools/src/erl_comment_scan.erl | |
parent | a6de62be5de44b249bc2d1c963c0c31bed5d32d0 (diff) | |
parent | fbc5f26d8f00277aca13fd97a0eef2423446c249 (diff) | |
download | otp-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.erl | 13 |
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) |