From 46a9d17ac331b1df9fbd33a7c23f87fd58246a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Tue, 18 Aug 2015 07:36:48 +0200 Subject: api: add argument "length" in function utf8_is_valid() --- doc/en/weechat_plugin_api.en.asciidoc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'doc/en/weechat_plugin_api.en.asciidoc') diff --git a/doc/en/weechat_plugin_api.en.asciidoc b/doc/en/weechat_plugin_api.en.asciidoc index 13fabe3df..2398e45e7 100644 --- a/doc/en/weechat_plugin_api.en.asciidoc +++ b/doc/en/weechat_plugin_api.en.asciidoc @@ -2151,18 +2151,22 @@ This function is not available in scripting API. ==== utf8_is_valid +_Updated in 1.4._ + Check if a string is UTF-8 valid. Prototype: [source,C] ---- -int weechat_utf8_is_valid (const char *string, char **error); +int weechat_utf8_is_valid (const char *string, int length, char **error); ---- Arguments: * 'string': string +* 'length': max number of UTF-8 chars to check; if ≤ 0, the whole string is + checked _(WeeChat ≥ 1.4)_ * 'error': if not NULL, '*error*' is set with pointer to first non valid UTF-8 char in string, if any @@ -2175,7 +2179,7 @@ C example: [source,C] ---- char *error; -if (weechat_utf8_is_valid (string, &error)) +if (weechat_utf8_is_valid (string, -1, &error)) { /* ... */ } -- cgit v1.2.3