diff options
author | Hans Bolinder <[email protected]> | 2013-02-15 11:58:12 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2013-02-15 13:05:24 +0100 |
commit | 22e3a1c772041cbb3a137a87436bf8b304c8499f (patch) | |
tree | bcd95ee1d2e39fad2db67b1912e23c22fa3aade5 /lib/stdlib | |
parent | 82cd2e914d68380f7d0dac2a47ed3aac25bc6c9d (diff) | |
download | otp-22e3a1c772041cbb3a137a87436bf8b304c8499f.tar.gz otp-22e3a1c772041cbb3a137a87436bf8b304c8499f.tar.bz2 otp-22e3a1c772041cbb3a137a87436bf8b304c8499f.zip |
[stdlib] Add documentation of ~tp
A short description of how ~tp works now.
Diffstat (limited to 'lib/stdlib')
-rw-r--r-- | lib/stdlib/doc/src/io.xml | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/stdlib/doc/src/io.xml b/lib/stdlib/doc/src/io.xml index 9f59fda6b5..63f814ad2e 100644 --- a/lib/stdlib/doc/src/io.xml +++ b/lib/stdlib/doc/src/io.xml @@ -494,8 +494,9 @@ ok <c>~w</c>, but breaks terms whose printed representation is longer than one line into many lines and indents each line sensibly. It also tries to detect lists of - printable characters and to output these as strings. - For example:</p> + printable characters and to output these as strings. The + Unicode translation modifier is used for determining + what characters are printable. For example:</p> <pre> 1> <input>T = [{attributes,[[{id,age,1.50000},{mode,explicit},</input> <input>{typename,"INTEGER"}], [{id,cho},{mode,explicit},{typename,'Cho'}]]},</input> @@ -546,6 +547,19 @@ ok [{a,[97]}, {b,[98]}] ok</pre> + <p>Binaries that look like UTF-8 encoded strings will be + output with the string syntax if the Unicode translation + modifier is given:</p> + <pre> +9> <input>io:fwrite("~p~n",[[1024]]).</input> +[1024] +10> <input>io:fwrite("~tp~n",[[1024]]).</input> +"\x{400}" +11> <input>io:fwrite("~tp~n", [<<128,128>>]).</input> +<<128,128>> +12> <input>io:fwrite("~tp~n", [<<208,128>>]).</input> +<<"\x{400}"/utf8>> +ok</pre> </item> <tag><c>W</c></tag> <item> |