diff options
author | Hans Bolinder <[email protected]> | 2013-01-25 13:04:01 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2013-01-25 13:04:10 +0100 |
commit | 4adc1523254d5e326e2d5cf942b5eeee84fdb8ea (patch) | |
tree | 527d936f6295f3d8f86ceecf44ff2310ab5508b2 /lib/stdlib/src/lib.erl | |
parent | 9afbb879f0397a650a7c403911a8cc30daa6dbbe (diff) | |
parent | 5b68f914f08479759d36557282aee29f44683d97 (diff) | |
download | otp-4adc1523254d5e326e2d5cf942b5eeee84fdb8ea.tar.gz otp-4adc1523254d5e326e2d5cf942b5eeee84fdb8ea.tar.bz2 otp-4adc1523254d5e326e2d5cf942b5eeee84fdb8ea.zip |
Merge branch 'hb/unicode/OTP-10302'
OTP-10742
OTP-10745
OTP-10749
* hb/unicode/OTP-10302:
[stdlib] Remove documentation of ~tp
Remove one use of iolist_size/1 in io_lib_pretty.erl
Add a new function proc_lib:format/2 which takes encoding
Export the type erl_scan:token()
Make adjustments for Unicode
[stdlib] Change default of erl_scan's unicode option
Update preloaded
Correct recently introduced Unicode related type errors
[stdlib] Introduce new functions epp:read_encoding_from_binary/1,2
Extend char() to Unicode characters
[kernel] Correct bugs in the old shell (user.erl)
[parsetools] Change the encoding of test suites to UTF-8
[stdlib] Fix a contract bug
[stdlib] Update the Unicode examples in STDLIB User's Guide
[stdlib] Remove documentation of Unicode functions in io_lib
Diffstat (limited to 'lib/stdlib/src/lib.erl')
-rw-r--r-- | lib/stdlib/src/lib.erl | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/stdlib/src/lib.erl b/lib/stdlib/src/lib.erl index b2ce2a5a8f..8351376691 100644 --- a/lib/stdlib/src/lib.erl +++ b/lib/stdlib/src/lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2012. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -44,7 +44,7 @@ flush_receive() -> Args :: [term()]. error_message(Format, Args) -> - io:format(<<"** ~s **\n">>, [io_lib:format(Format, Args)]). + io:format(<<"** ~ts **\n">>, [io_lib:format(Format, Args)]). %% Return the name of the script that starts (this) erlang %% @@ -84,10 +84,14 @@ sendw(To, Msg) -> %% eval_str(InStr) -> {ok, OutStr} | {error, ErrStr'} %% InStr must represent a body +%% Note: If InStr is a binary it has to be a Latin-1 string. +%% If you have a UTF-8 encoded binary you have to call +%% unicode:characters_to_list/1 before the call to eval_str(). -define(result(F,D), lists:flatten(io_lib:format(F, D))). --spec eval_str(string() | binary()) -> {'ok', string()} | {'error', string()}. +-spec eval_str(string() | unicode:latin1_binary()) -> + {'ok', string()} | {'error', string()}. eval_str(Str) when is_list(Str) -> case erl_scan:tokens([], Str, 0) of @@ -105,12 +109,12 @@ eval_str(Str) when is_list(Str) -> {error, ?result("*** eval: ~p", [Other])} end; {error, {_Line, Mod, Args}} -> - Msg = ?result("*** ~s",[Mod:format_error(Args)]), + Msg = ?result("*** ~ts",[Mod:format_error(Args)]), {error, Msg} end; false -> {error, ?result("Non-white space found after " - "end-of-form :~s", [Rest])} + "end-of-form :~ts", [Rest])} end end; eval_str(Bin) when is_binary(Bin) -> @@ -426,9 +430,9 @@ brackets_to_parens(S, Enc) -> [$(,R,$)]. printable_list(latin1, As) -> - io_lib:printable_list(As); + io_lib:printable_latin1_list(As); printable_list(_, As) -> - io_lib:printable_unicode_list(As). + io_lib:printable_list(As). mfa_to_string(M, F, A) -> io_lib:fwrite(<<"~s/~w">>, [mf_to_string({M, F}, A), A]). |