.\" -*- coding: UTF-8 -*- '\" t .\" Copyright (c) Bruno Haible .\" .\" SPDX-License-Identifier: GPL-2.0-or-later .\" .\" References consulted: .\" GNU glibc-2 source code and manual .\" OpenGroup's Single UNIX specification .\" http://www.UNIX-systems.org/online.html .\" .\" 2000-06-30 correction by Yuichi SATO .\" 2000-11-15 aeb, fixed prototype .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH iconv 3 "20 ​​Julio 2023" "Páginas de manual de Linux 6.05.01" .SH NOMBRE iconv \- realiza la conversión del conjunto de caracteres .SH BIBLIOTECA Biblioteca Estándar C (\fIlibc\fP, \fI\-lc\fP) .SH SINOPSIS .nf \fB#include \fP .PP \fBsize_t iconv(iconv_t \fP\fIcd\fP\fB,\fP \fB char **restrict \fP\fIinbuf\fP\fB, size_t *restrict \fP\fIinbytesleft\fP\fB,\fP \fB char **restrict \fP\fIoutbuf\fP\fB, size_t *restrict \fP\fIoutbytesleft\fP\fB);\fP .fi .SH DESCRIPCIÓN The \fBiconv\fP() function converts a sequence of characters in one character encoding to a sequence of characters in another character encoding. The \fIcd\fP argument is a conversion descriptor, previously created by a call to \fBiconv_open\fP(3); the conversion descriptor defines the character encodings that \fBiconv\fP() uses for the conversion. The \fIinbuf\fP argument is the address of a variable that points to the first character of the input sequence; \fIinbytesleft\fP indicates the number of bytes in that buffer. The \fIoutbuf\fP argument is the address of a variable that points to the first byte available in the output buffer; \fIoutbytesleft\fP indicates the number of bytes available in the output buffer. .PP El principal caso se da cuando \fIinbuf\fP es distinto de NULL y \fI*inbuf\fP es distinto de NULL. En este caso, la función \fBiconv\fP() convierte la secuencia multibyte que comienza en \fI*inbuf\fP en una secuencia multibyte que comenzará en \fI*outbuf\fP. Como mucho se leerán \fI*inbytesleft\fP bytes, comenzando en \fI*inbuf\fP. Como mucho se escribirán \fI*outbytesleft\fP bytes, comenzando en \fI*outbuf\fP. .PP The \fBiconv\fP() function converts one multibyte character at a time, and for each character conversion it increments \fI*inbuf\fP and decrements \fI*inbytesleft\fP by the number of converted input bytes, it increments \fI*outbuf\fP and decrements \fI*outbytesleft\fP by the number of converted output bytes, and it updates the conversion state contained in \fIcd\fP. If the character encoding of the input is stateful, the \fBiconv\fP() function can also convert a sequence of input bytes to an update to the conversion state without producing any output bytes; such input is called a \fIshift sequence\fP. The conversion can stop for five reasons: .IP \[bu] 3 Se encontró una secuencia multibyte inválida en la entrada. En este caso se asigna a \fIerrno\fP el valor \fBEILSEQ\fP y se devuelve \fI(size_t)\ \-1\fP. \fI*inbuf\fP se deja apuntando al principio de la secuencia multibyte inválida. .IP \[bu] A multibyte sequence is encountered that is valid but that cannot be translated to the character encoding of the output. This condition depends on the implementation and on the conversion descriptor. In the GNU C library and GNU libiconv, if \fIcd\fP was created without the suffix \fB//TRANSLIT\fP or \fB//IGNORE\fP, the conversion is strict: lossy conversions produce this condition. If the suffix \fB//TRANSLIT\fP was specified, transliteration can avoid this condition in some cases. In the musl C library, this condition cannot occur because a conversion to \fB\[aq]*\[aq]\fP is used as a fallback. In the FreeBSD, NetBSD, and Solaris implementations of \fBiconv\fP(), this condition cannot occur either, because a conversion to \fB\[aq]?\[aq]\fP is used as a fallback. When this condition is met, \fBiconv\fP() sets \fIerrno\fP to \fBEILSEQ\fP and returns \fI(size_t)\ \-1\fP. \fI*inbuf\fP is left pointing to the beginning of the unconvertible multibyte sequence. .IP \[bu] La secuencia de bytes de entrada ha sido totalmente convertida, esto es, \fI*inbytesleft\fP ha llegado a 0. En este caso \fBiconv\fP() devuelve el número de conversiones no recuperables realizadas durante esta llamada. .IP \[bu] Se encontró una secuencia multibyte incompleta en la entrada, y la secuencia de bytes de entrada termina después de ella. En este caso se asigna a \fIerrno\fP el valor \fBEINVAL\fP y se devuelve \fI(size_t)\ \-1\fP. \fI*inbuf\fP se deja apuntando al principio de la secuencia multibyte incompleta. .IP \[bu] El buffer de salida no tiene suficiente espacio para el siguiente carácter convertido. En este caso se asigna a \fIerrno\fP el valor \fBE2BIG\fP y se devuelve \fI(size_t)\ \-1\fP. .PP Un caso diferente es cuando \fIinbuf\fP es NULL o \fI*inbuf\fP es NULL, pero \fIoutbuf\fP no es NULL y \fI*outbuf\fP no es NULL. En este caso, la función \fBiconv\fP() intenta poner el estado de conversión de \fIcd\fP en el estado inicial y almacenar una secuencia de cambios correspondiente en \fI*outbuf\fP. Como mucho se ecribirán \fI*outbytesleft\fP bytes, comenzando en \fI*outbuf\fP. Si el buffer de salida se queda sin espacio para esta secuencia de reinicio, la función asigna a \fIerrno\fP el valor \fBE2BIG\fP y devuelve \fI(size_t)\ \-1\fP. En otro caso incrementa \fI*outbuf\fP y decrementa \fI*outbytesleft\fP con el número de bytes escritos. .PP Un tercer caso es cuando \fIinbuf\fP es NULL o \fI*inbuf\fP es NULL, y \fIoutbuf\fP es NULL o \fI*outbuf\fP es NULL. En este caso, la función \fBiconv\fP() pone el estado de conversión de \fIcd\fP en el estado inicial. .SH "VALOR DEVUELTO" The \fBiconv\fP() function returns the number of characters converted in a nonreversible way during this call; reversible conversions are not counted. In case of error, \fBiconv\fP() returns \fI(size_t)\ \-1\fP and sets \fIerrno\fP to indicate the error. .SH ERRORES Pueden ocurrir los siguientes errores, entre otros: .TP \fBE2BIG\fP No hay suficiente espacio en \fI*outbuf\fP. .TP \fBEILSEQ\fP Se encontró una secuencia multibyte inválida a la entrada. .TP \fBEINVAL\fP Se encontró una secuencia multibyte incompleta a la entrada. .SH ATRIBUTOS Para obtener una explicación de los términos usados en esta sección, véase \fBattributes\fP(7). .TS allbox; lbx lb lb l l l. Interfaz Atributo Valor T{ .na .nh \fBiconv\fP() T} Seguridad del hilo MT\-Safe race:cd .TE .sp 1 .PP The \fBiconv\fP() function is MT\-Safe, as long as callers arrange for mutual exclusion on the \fIcd\fP argument. .SH ESTÁNDARES POSIX.1\-2008. .SH HISTORIAL glibc 2.1. POSIX.1\-2001. .SH NOTAS In each series of calls to \fBiconv\fP(), the last should be one with \fIinbuf\fP or \fI*inbuf\fP equal to NULL, in order to flush out any partially converted input. .PP Although \fIinbuf\fP and \fIoutbuf\fP are typed as \fIchar\ **\fP, this does not mean that the objects they point can be interpreted as C strings or as arrays of characters: the interpretation of character byte sequences is handled internally by the conversion functions. In some encodings, a zero byte may be a valid part of a multibyte character. .PP The caller of \fBiconv\fP() must ensure that the pointers passed to the function are suitable for accessing characters in the appropriate character set. This includes ensuring correct alignment on platforms that have tight restrictions on alignment. .SH "VÉASE TAMBIÉN" \fBiconv_close\fP(3), \fBiconv_open\fP(3), \fBiconvconfig\fP(8) .PP .SH TRADUCCIÓN La traducción al español de esta página del manual fue creada por Miguel Pérez Ibars . .PP Esta traducción es documentación libre; lea la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 .UE o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD. .PP Si encuentra algún error en la traducción de esta página del manual, envíe un correo electrónico a .MT debian-l10n-spanish@lists.debian.org .ME .