Provided by: manpages-es-dev_4.21.0-2_all bug

NOMBRE

       iconv - realiza la conversión del conjunto de caracteres

BIBLIOTECA

       Biblioteca Estándar C (libc, -lc)

SINOPSIS

       #include <iconv.h>

       size_t iconv(iconv_t cd,
                    char **restrict inbuf, size_t *restrict inbytesleft,
                    char **restrict outbuf, size_t *restrict outbytesleft);

DESCRIPCIÓN

       The  iconv()   function  converts  a  sequence  of  characters in one character encoding to a sequence of
       characters in another character encoding.  The cd argument is a conversion descriptor, previously created
       by a call to iconv_open(3); the conversion descriptor defines the character encodings that iconv()   uses
       for  the  conversion.  The inbuf argument is the address of a variable that points to the first character
       of the input sequence; inbytesleft indicates the number of bytes in that buffer.  The outbuf argument  is
       the  address  of  a  variable  that points to the first byte available in the output buffer; outbytesleft
       indicates the number of bytes available in the output buffer.

       El principal caso se da cuando inbuf es distinto de NULL y *inbuf es distinto de NULL.  En este caso,  la
       función  iconv()  convierte  la secuencia multibyte que comienza en *inbuf en una secuencia multibyte que
       comenzará en *outbuf.  Como mucho se leerán *inbytesleft bytes, comenzando  en  *inbuf.   Como  mucho  se
       escribirán *outbytesleft bytes, comenzando en *outbuf.

       The  iconv()   function  converts one multibyte character at a time, and for each character conversion it
       increments *inbuf and decrements *inbytesleft by the number  of  converted  input  bytes,  it  increments
       *outbuf  and  decrements  *outbytesleft  by  the  number  of  converted  output bytes, and it updates the
       conversion state contained in cd.  If the character encoding  of  the  input  is  stateful,  the  iconv()
       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 shift sequence.  The  conversion  can  stop  for  four
       reasons:

       •  Se  encontró  una  secuencia multibyte inválida en la entrada. En este caso se asigna a errno el valor
          EILSEQ y se devuelve (size_t) -1. *inbuf se deja apuntando al  principio  de  la  secuencia  multibyte
          inválida.

       •  La  secuencia de bytes de entrada ha sido totalmente convertida, esto es, *inbytesleft ha llegado a 0.
          En este caso iconv() devuelve el número  de  conversiones  no  recuperables  realizadas  durante  esta
          llamada.

       •  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 errno el valor EINVAL  y  se  devuelve  (size_t) -1.
          *inbuf se deja apuntando al principio de la secuencia multibyte incompleta.

       •  El buffer de salida no tiene suficiente espacio para el siguiente carácter convertido. En este caso se
          asigna a errno el valor E2BIG y se devuelve (size_t) -1.

       Un  caso diferente es cuando inbuf es NULL o *inbuf es NULL, pero outbuf no es NULL y *outbuf no es NULL.
       En este caso, la función iconv() intenta poner el estado de conversión de  cd  en  el  estado  inicial  y
       almacenar  una  secuencia  de  cambios correspondiente en *outbuf.  Como mucho se ecribirán *outbytesleft
       bytes, comenzando en *outbuf.  Si el buffer de salida  se  queda  sin  espacio  para  esta  secuencia  de
       reinicio,  la  función  asigna  a  errno  el  valor E2BIG y devuelve (size_t) -1. En otro caso incrementa
       *outbuf y decrementa *outbytesleft con el número de bytes escritos.

       Un tercer caso es cuando inbuf es NULL o *inbuf es NULL, y outbuf es NULL o  *outbuf  es  NULL.  En  este
       caso, la función iconv() pone el estado de conversión de cd en el estado inicial.

VALOR DEVUELTO

       The iconv()  function returns the number of characters converted in a nonreversible way during this call;
       reversible conversions are not counted.  In case of error, iconv()  returns (size_t) -1 and sets errno to
       indicate the error.

ERRORES

       Pueden ocurrir los siguientes errores, entre otros:

       E2BIG  No hay suficiente espacio en *outbuf.

       EILSEQ Se encontró una secuencia multibyte inválida a la entrada.

       EINVAL Se encontró una secuencia multibyte incompleta a la entrada.

VERSIONES

       This function is available since glibc 2.1.

ATRIBUTOS

       Para obtener una explicación de los términos usados en esta sección, véase attributes(7).
       ┌────────────────────────────────────────────────────────────────┬────────────────────┬─────────────────┐
       │ InterfazAtributoValor           │
       ├────────────────────────────────────────────────────────────────┼────────────────────┼─────────────────┤
       │ iconv()                                                        │ Seguridad del hilo │ MT-Safe race:cd │
       └────────────────────────────────────────────────────────────────┴────────────────────┴─────────────────┘

       The iconv()  function is MT-Safe, as long as callers arrange for mutual exclusion on the cd argument.

ESTÁNDARES

       POSIX.1-2001, POSIX.1-2008.

NOTAS

       In  each  series of calls to iconv(), the last should be one with inbuf or *inbuf equal to NULL, in order
       to flush out any partially converted input.

       Although inbuf and outbuf are typed as char **, 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.

       The  caller  of  iconv()  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.

VÉASE TAMBIÉN

       iconv_close(3), iconv_open(3), iconvconfig(8)

TRADUCCIÓN

       La traducción al español de esta página del manual fue creada por Miguel Pérez Ibars <mpi79470@alu.um.es>

       Esta  traducción  es  documentación  libre;  lea  la GNU General Public License Version 3 o posterior con
       respecto a las condiciones de copyright.  No existe NINGUNA RESPONSABILIDAD.

       Si encuentra algún error en la traducción de esta página  del  manual,  envíe  un  correo  electrónico  a
       debian-l10n-spanish@lists.debian.org.

Páginas de manual de Linux 6.03                  5 Febrero 2023                                         iconv(3)