diff options
author | Björn Gustavsson <[email protected]> | 2017-04-11 13:55:20 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2017-04-12 12:28:56 +0200 |
commit | 4402730cead48757d8086c388acbd86366d291a1 (patch) | |
tree | a554f793d9c9fa04c865900d3d18b73441ece310 /lib/compiler | |
parent | a7307600a2b8dbcf628ae8ccf26137bc32f060cc (diff) | |
download | otp-4402730cead48757d8086c388acbd86366d291a1.tar.gz otp-4402730cead48757d8086c388acbd86366d291a1.tar.bz2 otp-4402730cead48757d8086c388acbd86366d291a1.zip |
Atoms in Core Erlang must be encoded in UTF-8
core_scan will now support and require atoms encoded in UTF-8.
Diffstat (limited to 'lib/compiler')
-rw-r--r-- | lib/compiler/src/core_scan.erl | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/compiler/src/core_scan.erl b/lib/compiler/src/core_scan.erl index 15bfc78c8b..d7d5f900de 100644 --- a/lib/compiler/src/core_scan.erl +++ b/lib/compiler/src/core_scan.erl @@ -283,10 +283,12 @@ scan1([$$|Cs0], Toks, Pos) -> %Character constant scan1(Cs, [{char,Pos,C}|Toks], Pos1); scan1([$'|Cs0], Toks, Pos) -> %Atom (always quoted) {S,Cs1,Pos1} = scan_string(Cs0, $', Pos), - case catch list_to_atom(S) of + try binary_to_atom(list_to_binary(S), utf8) of A when is_atom(A) -> - scan1(Cs1, [{atom,Pos,A}|Toks], Pos1); - _Error -> scan_error({illegal,atom}, Pos) + scan1(Cs1, [{atom,Pos,A}|Toks], Pos1) + catch + error:_ -> + scan_error({illegal,atom}, Pos) end; scan1([$"|Cs0], Toks, Pos) -> %String {S,Cs1,Pos1} = scan_string(Cs0, $", Pos), |