aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2017-04-24 14:46:57 +0200
committerHans Bolinder <[email protected]>2017-04-24 14:51:03 +0200
commit4567b6afc41a5d18384916c171ae413112ee57cc (patch)
tree3b32f28efbec8e56bd95e3b390205836eb1b9375 /lib
parentef0dbc4f2a43d629d086c3e2b9a762bbc00d034b (diff)
downloadotp-4567b6afc41a5d18384916c171ae413112ee57cc.tar.gz
otp-4567b6afc41a5d18384916c171ae413112ee57cc.tar.bz2
otp-4567b6afc41a5d18384916c171ae413112ee57cc.zip
stdlib: Add Unicode modifier t to control sequence a
The Unicode translation modifier 't' is added to the io:fread/2,3 control sequence 'a'.
Diffstat (limited to 'lib')
-rw-r--r--lib/stdlib/doc/src/io.xml2
-rw-r--r--lib/stdlib/src/io_lib_fread.erl11
-rw-r--r--lib/stdlib/test/io_SUITE.erl9
3 files changed, 14 insertions, 8 deletions
diff --git a/lib/stdlib/doc/src/io.xml b/lib/stdlib/doc/src/io.xml
index 74b57457ea..64fcf4379f 100644
--- a/lib/stdlib/doc/src/io.xml
+++ b/lib/stdlib/doc/src/io.xml
@@ -569,8 +569,6 @@ Prompt> <input>&lt;Characters beyond latin1 range not printable in this medium&g
<item>
<p>Similar to <c>s</c>, but the resulting string is
converted into an atom.</p>
- <p>The Unicode translation modifier is not allowed (atoms
- cannot contain characters beyond the <c>latin1</c> range).</p>
</item>
<tag><c>c</c></tag>
<item>
diff --git a/lib/stdlib/src/io_lib_fread.erl b/lib/stdlib/src/io_lib_fread.erl
index 6a8f8f728e..983e8d4566 100644
--- a/lib/stdlib/src/io_lib_fread.erl
+++ b/lib/stdlib/src/io_lib_fread.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2016. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2017. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -159,8 +159,8 @@ fread_field([$t|Format], F, Sup, _Unic) ->
fread_field(Format, F, Sup, Unic) ->
{Format,F,Sup,Unic}.
-%% fread1(Format, FieldWidth, Suppress, Line, N, Results, AllFormat)
-%% fread1(Format, FieldWidth, Suppress, Line, N, Results)
+%% fread1(Format, FieldWidth, Suppress, Unicode, Line, N, Results, AllFormat)
+%% fread1(Format, FieldWidth, Suppress, Unicode, Line, N, Results)
%% The main dispatch function for the formatting commands. Done in two
%% stages so format commands that need no input can always be processed.
@@ -231,9 +231,8 @@ fread1([$s|Format], none, Sup, U, Line0, N0, Res) ->
fread1([$s|Format], F, Sup, U, Line0, N, Res) ->
{Line,Cs} = fread_chars(Line0, F, U),
fread_string(Cs, Sup, U, Format, Line, N+F, Res);
-%% XXX:PaN Atoms still only latin1...
-fread1([$a|Format], none, Sup, false, Line0, N0, Res) ->
- {Line,N,Cs} = fread_string_cs(Line0, N0, false),
+fread1([$a|Format], none, Sup, U, Line0, N0, Res) ->
+ {Line,N,Cs} = fread_string_cs(Line0, N0, U),
fread_atom(Cs, Sup, Format, Line, N, Res);
fread1([$a|Format], F, Sup, false, Line0, N, Res) ->
{Line,Cs} = fread_chars(Line0, F, false),
diff --git a/lib/stdlib/test/io_SUITE.erl b/lib/stdlib/test/io_SUITE.erl
index fb62e3aa3c..ef3f0be5d7 100644
--- a/lib/stdlib/test/io_SUITE.erl
+++ b/lib/stdlib/test/io_SUITE.erl
@@ -2359,6 +2359,15 @@ otp_14285(_Config) ->
"'кирилли́ческий атом'" = fmt("~tW", ['кирилли́ческий атом', 13]),
[$',16#10FFFF,$'] = fmt("~tW", ['\x{10FFFF}', 13]),
+ {ok, [an_atom],[]} = io_lib:fread("~a", "an_atom"),
+ {ok, [an_atom],[]} = io_lib:fread("~ta", "an_atom"),
+ Str = "\"ab" ++ [1089] ++ "cd\"",
+ {ok, ["\"ab"], [1089]++"cd\""} = io_lib:fread("~s", Str),
+ {ok, ['\"ab'], [1089]++"cd\""} = io_lib:fread("~a", Str),
+ {ok,[Str], []} = io_lib:fread("~ts", Str),
+ {ok,[Atom],[]} = io_lib:fread("~ta", Str),
+ Str = atom_to_list(Atom),
+
ok.
latin1_fmt(Fmt, Args) ->