From 22e3a1c772041cbb3a137a87436bf8b304c8499f Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Fri, 15 Feb 2013 11:58:12 +0100 Subject: [stdlib] Add documentation of ~tp A short description of how ~tp works now. --- lib/stdlib/doc/src/io.xml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'lib/stdlib') 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 ~w, 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:

+ printable characters and to output these as strings. The + Unicode translation modifier is used for determining + what characters are printable. For example:

 1> T = [{attributes,[[{id,age,1.50000},{mode,explicit},
 {typename,"INTEGER"}], [{id,cho},{mode,explicit},{typename,'Cho'}]]},
@@ -545,6 +546,19 @@ ok
 7> io:fwrite("~15lp~n", [S]).
 [{a,[97]},
  {b,[98]}]
+ok
+

Binaries that look like UTF-8 encoded strings will be + output with the string syntax if the Unicode translation + modifier is given:

+
+9> io:fwrite("~p~n",[[1024]]).
+[1024]
+10> io:fwrite("~tp~n",[[1024]]).
+"\x{400}"
+11> io:fwrite("~tp~n", [<<128,128>>]).
+<<128,128>>
+12> io:fwrite("~tp~n", [<<208,128>>]).
+<<"\x{400}"/utf8>>
 ok
W -- cgit v1.2.3