mirror of
https://github.com/weechat/weechat.git
synced 2026-07-08 18:53:12 +02:00
api: add argument "length" in function utf8_is_valid()
This commit is contained in:
@@ -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))
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
|
||||
@@ -2193,18 +2193,22 @@ Cette fonction n'est pas disponible dans l'API script.
|
||||
|
||||
==== utf8_is_valid
|
||||
|
||||
_Mis à jour dans la 1.4._
|
||||
|
||||
Vérifier si une chaîne est valide UTF-8.
|
||||
|
||||
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);
|
||||
----
|
||||
|
||||
Paramètres :
|
||||
|
||||
* 'string' : chaîne
|
||||
* 'length' : nombre maximum de caractères UTF-8 à vérifier ; si ≤ 0, la chaîne
|
||||
complète est vérifiée _(WeeChat ≥ 1.4)_
|
||||
* 'error' : si non NULL, '*error' est alimenté avec le pointeur vers le premier
|
||||
caractère non valide dans la chaîne, s'il y en a
|
||||
|
||||
@@ -2217,7 +2221,7 @@ Exemple en C :
|
||||
[source,C]
|
||||
----
|
||||
char *error;
|
||||
if (weechat_utf8_is_valid (string, &error))
|
||||
if (weechat_utf8_is_valid (string, -1, &error))
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
|
||||
@@ -2226,18 +2226,24 @@ Questa funzione non è disponibile nelle API per lo scripting.
|
||||
|
||||
==== utf8_is_valid
|
||||
|
||||
// TRANSLATION MISSING
|
||||
_Updated in 1.4._
|
||||
|
||||
Verifica che una stringa sia valida in UTF-8.
|
||||
|
||||
Prototipo:
|
||||
|
||||
[source,C]
|
||||
----
|
||||
int weechat_utf8_is_valid (const char *string, char **error);
|
||||
int weechat_utf8_is_valid (const char *string, int length, char **error);
|
||||
----
|
||||
|
||||
Argomenti:
|
||||
|
||||
* 'string': stringa
|
||||
// TRANSLATION MISSING
|
||||
* 'length': max number of UTF-8 chars to check; if ≤ 0, the whole string is
|
||||
checked _(WeeChat ≥ 1.4)_
|
||||
* 'error': se non NULL, '*error*' è impostato con il puntatore al primo
|
||||
carattere UTF-8 non valido nella stringa, se esiste
|
||||
|
||||
@@ -2250,7 +2256,7 @@ Esempio in C:
|
||||
[source,C]
|
||||
----
|
||||
char *error;
|
||||
if (weechat_utf8_is_valid (string, &error))
|
||||
if (weechat_utf8_is_valid (string, -1, &error))
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
|
||||
@@ -2152,18 +2152,23 @@ if (weechat_utf8_has_8bits (string))
|
||||
|
||||
==== utf8_is_valid
|
||||
|
||||
_バージョン 1.4 で更新。_
|
||||
|
||||
文字列が妥当な UTF-8 表現か確認。
|
||||
|
||||
プロトタイプ:
|
||||
|
||||
[source,C]
|
||||
----
|
||||
int weechat_utf8_is_valid (const char *string, char **error);
|
||||
int weechat_utf8_is_valid (const char *string, int length, char **error);
|
||||
----
|
||||
|
||||
引数:
|
||||
|
||||
* 'string': 文字列
|
||||
// TRANSLATION MISSING
|
||||
* 'length': max number of UTF-8 chars to check; if ≤ 0, the whole string is
|
||||
checked _(WeeChat ≥ 1.4)_
|
||||
* 'error': NULL でない場合は '*error*'
|
||||
は文字列に含まれる最初の妥当でない UTF-8 文字へのポインタ
|
||||
|
||||
@@ -2176,7 +2181,7 @@ C 言語での使用例:
|
||||
[source,C]
|
||||
----
|
||||
char *error;
|
||||
if (weechat_utf8_is_valid (string, &error))
|
||||
if (weechat_utf8_is_valid (string, -1, &error))
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user