diff options
author | Siri Hansen <[email protected]> | 2017-06-09 17:45:09 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2017-06-16 11:52:21 +0200 |
commit | 98e0ccb4a56b3b2b6a552463f78e699ec7490669 (patch) | |
tree | 52c9895c903b655f9e99c821c701de338e7da60d /lib | |
parent | 7b62bdcc96cbfcb631ceb99d277a9d2c117042a2 (diff) | |
download | otp-98e0ccb4a56b3b2b6a552463f78e699ec7490669.tar.gz otp-98e0ccb4a56b3b2b6a552463f78e699ec7490669.tar.bz2 otp-98e0ccb4a56b3b2b6a552463f78e699ec7490669.zip |
[stdlib] Open error log file as utf8
This allows the use of ~ts/~tp/~tw in calls to error_logger:format/2,
error_logger:error_msg/2 and error_logger:info_msg/2.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kernel/doc/src/error_logger.xml | 20 | ||||
-rw-r--r-- | lib/kernel/doc/src/kernel_app.xml | 2 | ||||
-rw-r--r-- | lib/stdlib/src/error_logger_file_h.erl | 2 |
3 files changed, 21 insertions, 3 deletions
diff --git a/lib/kernel/doc/src/error_logger.xml b/lib/kernel/doc/src/error_logger.xml index 27db00819f..91bf57cb91 100644 --- a/lib/kernel/doc/src/error_logger.xml +++ b/lib/kernel/doc/src/error_logger.xml @@ -126,6 +126,12 @@ ok</pre> <seealso marker="#error_report/1"><c>error_report/1</c></seealso> instead.</p> </warning> + <warning> + <p>If the Unicode translation modifier (<c>t</c>) is used in + the format string, all error handlers must ensure that the + formatted output is correctly encoded for the I/O + device.</p> + </warning> </desc> </func> <func> @@ -197,6 +203,12 @@ ok</pre> the standard event handler, meaning no further events are logged. When in doubt, use <c>info_report/1</c> instead.</p> </warning> + <warning> + <p>If the Unicode translation modifier (<c>t</c>) is used in + the format string, all error handlers must ensure that the + formatted output is correctly encoded for the I/O + device.</p> + </warning> </desc> </func> <func> @@ -262,7 +274,7 @@ ok</pre> successful, or <c>{error, allready_have_logfile}</c> if logging to file is already enabled, or an error tuple if another error occurred (for example, if <c><anno>Filename</anno></c> - cannot be opened).</p> + cannot be opened). The file is opened with encoding UTF-8.</p> </item> <tag><c>close</c></tag> <item> @@ -345,6 +357,12 @@ ok</pre> the standard event handler, meaning no further events are logged. When in doubt, use <c>warning_report/1</c> instead.</p> </warning> + <warning> + <p>If the Unicode translation modifier (<c>t</c>) is used in + the format string, all error handlers must ensure that the + formatted output is correctly encoded for the I/O + device.</p> + </warning> </desc> </func> <func> diff --git a/lib/kernel/doc/src/kernel_app.xml b/lib/kernel/doc/src/kernel_app.xml index 75e1e18d86..e5ac031539 100644 --- a/lib/kernel/doc/src/kernel_app.xml +++ b/lib/kernel/doc/src/kernel_app.xml @@ -186,7 +186,7 @@ <tag><c>{file, FileName}</c></tag> <item><p>Installs the standard event handler, which prints error reports to file <c>FileName</c>, where <c>FileName</c> - is a string.</p></item> + is a string. The file is opened with encoding UTF-8.</p></item> <tag><c>false</c></tag> <item> <p>No standard event handler is installed, but diff --git a/lib/stdlib/src/error_logger_file_h.erl b/lib/stdlib/src/error_logger_file_h.erl index 76f89841b9..b7c193f965 100644 --- a/lib/stdlib/src/error_logger_file_h.erl +++ b/lib/stdlib/src/error_logger_file_h.erl @@ -55,7 +55,7 @@ init(File) -> init(File, PrevHandler) -> process_flag(trap_exit, true), - case file:open(File, [write]) of + case file:open(File, [write,{encoding,utf8}]) of {ok,Fd} -> Depth = error_logger:get_format_depth(), State = #st{fd=Fd,filename=File,prev_handler=PrevHandler, |