.\" -*- coding: UTF-8 -*- .\" Copyright (c) Bruno Haible .\" .\" %%%LICENSE_START(GPLv2+_DOC_ONEPARA) .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of .\" the License, or (at your option) any later version. .\" %%%LICENSE_END .\" .\" 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 "15 Septiembre 2017" GNU "Manual del Programador de Linux" .SH NOMBRE iconv \- realiza la conversión del conjunto de caracteres .SH SINOPSIS .nf \fB#include \fP .PP \fBsize_t iconv(iconv_t \fP\fIcd\fP\fB,\fP \fB char **\fP\fIinbuf\fP\fB, size_t *\fP\fIinbytesleft\fP\fB,\fP \fB char **\fP\fIoutbuf\fP\fB, size_t *\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 four reasons: .IP 1. 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 2. 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 3. 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 4. 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" La función \fBiconv\fP() devuelve el número de caracteres convertidos de manera no\-recuperable durante la llamada; las conversiones recuperables no se cuentan. En caso de error, modifica \fIerrno\fP con un valor apropiado y devuelve \fI(size_t)\ \-1\fP. .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 VERSIONES This function is available in glibc since version 2.1. .SH ATRIBUTOS Para obtener una explicación de los términos usados en esta sección, véase \fBattributes\fP(7). .TS allbox; lb lb lb l l l. Interfaz Atributo Valor T{ \fBiconv\fP() T} Seguridad del hilo MT\-Safe race:cd .TE .PP The \fBiconv\fP() function is MT\-Safe, as long as callers arrange for mutual exclusion on the \fIcd\fP argument. .SH "CONFORME A" POSIX.1\-2001, POSIX.1\-2008. .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) .SH COLOFÓN Esta página es parte de la versión 5.10 del proyecto Linux \fIman\-pages\fP. Puede encontrar una descripción del proyecto, información sobre cómo informar errores y la última versión de esta página en \%https://www.kernel.org/doc/man\-pages/. .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 .