diff options
author | Hans Bolinder <[email protected]> | 2013-01-02 14:59:02 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2013-01-25 12:54:27 +0100 |
commit | ec8343bec35fcb941712a22cc0b150c5d24be2df (patch) | |
tree | 8653306901a74fefd272de31418b488f62a262f8 /lib/stdlib/doc/src | |
parent | 83e9d1c4c2c12d3509e3399f4dcd8bfa826ea884 (diff) | |
download | otp-ec8343bec35fcb941712a22cc0b150c5d24be2df.tar.gz otp-ec8343bec35fcb941712a22cc0b150c5d24be2df.tar.bz2 otp-ec8343bec35fcb941712a22cc0b150c5d24be2df.zip |
[stdlib] Update the Unicode examples in STDLIB User's Guide
Diffstat (limited to 'lib/stdlib/doc/src')
-rw-r--r-- | lib/stdlib/doc/src/io.xml | 7 | ||||
-rw-r--r-- | lib/stdlib/doc/src/unicode_usage.xml | 18 |
2 files changed, 14 insertions, 11 deletions
diff --git a/lib/stdlib/doc/src/io.xml b/lib/stdlib/doc/src/io.xml index 22cd45a482..e904f0f0c8 100644 --- a/lib/stdlib/doc/src/io.xml +++ b/lib/stdlib/doc/src/io.xml @@ -440,9 +440,12 @@ ok</pre> </item> <tag><c>s</c></tag> <item> - <p>Prints the argument with the <c>string</c> syntax. The + <p>Prints the argument with the string syntax. The argument is, if no Unicode translation modifier is present, an - iolist(), a binary, or an atom. If the Unicode translation modifier (<c>t</c>) is in effect, the argument is unicode:chardata(), meaning that binaries are in UTF-8. The characters + <c>iolist()</c>, a <c>binary()</c>, or an <c>atom()</c>. + If the Unicode translation modifier (<c>t</c>) is in effect, + the argument is <c>unicode:chardata()</c>, meaning that + binaries are in UTF-8. The characters are printed without quotes. The string is first truncated by the given precision and then padded and justified to the given field width. The default precision is the field width.</p> diff --git a/lib/stdlib/doc/src/unicode_usage.xml b/lib/stdlib/doc/src/unicode_usage.xml index 320b5b2e84..0a75fbeec0 100644 --- a/lib/stdlib/doc/src/unicode_usage.xml +++ b/lib/stdlib/doc/src/unicode_usage.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>1999</year> - <year>2012</year> + <year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -163,10 +163,10 @@ Erlang R16B (erts-5.10) [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.10 (abort with ^G) 1> <input>lists:keyfind(encoding, 1, io:getopts()).</input> {encoding,unicode} -2> <input>"уницоде"</input> -"уницоде" +2> <input>"Юникод"</input> +"Юникод" 3> <input>io:format("~ts~n", [v(2)]).</input> -уницоде +Юникод ok 4> </pre> <p>While strings can be input as Unicode characters, the language elements are still limited to the ISO-latin-1 character set. Only character constants and strings are allowed to be beyond that range:</p> @@ -177,7 +177,7 @@ Erlang R16B (erts-5.10) [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.10 (abort with ^G) 1> <input>$ξ</input> 958 -2> <input>уницоде.</input> +2> <input>Юникод.</input> * 1: illegal character 2> </pre> </section> @@ -305,10 +305,10 @@ $ <input>erl</input> Erlang R16B (erts-5.10) [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.10 (abort with ^G) -1> <input>io_lib:format("~ts~n", ["θνιψοδε"]).</input> -["θνιψοδε","\n"] -2> <input>io:put_chars(io_lib:format("~ts~n", ["θνιψοδε"])).</input> -θνιψοδε +1> <input>io_lib:format("~ts~n", ["Γιούνικοντ"]).</input> +["Γιούνικοντ","\n"] +2> <input>io:put_chars(io_lib:format("~ts~n", ["Γιούνικοντ"])).</input> +Γιούνικοντ ok</pre> <p>The Unicode string is returned as a Unicode list, which is recognized as such since the Erlang shell uses the Unicode encoding. The Unicode list is valid input to the <seealso marker="stdlib:io#put_chars/2">io:put_chars/2</seealso> function, so data can be output on any Unicode capable device. If the device is a terminal, characters will be output in the <c>\x{</c>H ...<c>}</c> format if encoding is <c>latin1</c> otherwise in UTF-8 (for the non-interactive terminal - "oldshell" or "noshell") or whatever is suitable to show the character properly (for an interactive terminal - the regular shell). The bottom line is that you can always send Unicode data to the <c>standard_io</c> device. Files will however only accept Unicode codepoints beyond ISO-latin-1 if <c>encoding</c> is set to something else than <c>latin1</c>.</p> </section> |