From e1370f924df65e72843b5f81400230e1c2591485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 19 May 2017 16:06:08 +0200 Subject: Return error tuple on unicode normalization functions Prior to this patch, the normalization functions in the unicode module would raise a function clause error for non-utf8 binaries. This patch changes it so it returns {error, SoFar, Invalid} as characters_to_binary and characters_to_list does in the unicode module. Note string:next_codepoint/1 and string:next_grapheme had to be changed accordingly and also return an error tuple. --- lib/stdlib/doc/src/string.xml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/stdlib/doc') diff --git a/lib/stdlib/doc/src/string.xml b/lib/stdlib/doc/src/string.xml index 343904a49a..9d5edd9ecf 100644 --- a/lib/stdlib/doc/src/string.xml +++ b/lib/stdlib/doc/src/string.xml @@ -311,7 +311,9 @@ true

Returns the first codepoint in String - and the rest of String in the tail. + and the rest of String in the tail. Returns + an empty list if String is empty or an + {error, String} tuple if the next byte is invalid.

Example:

@@ -326,7 +328,9 @@ true

Returns the first grapheme cluster in String - and the rest of String in the tail. + and the rest of String in the tail. Returns + an empty list if String is empty or an + {error, String} tuple if the next byte is invalid.

Example:

-- 
cgit v1.2.3