Provided by: manpages-es-dev_4.27.0-1_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  five
       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.

       •  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 cd was created without the suffix //TRANSLIT or
          //IGNORE,  the  conversion  is  strict:  lossy  conversions  produce  this  condition.   If the suffix
          //TRANSLIT was specified, transliteration can avoid this condition in  some  cases.   In  the  musl  C
          library,  this  condition  cannot  occur  because  a  conversion to '*' is used as a fallback.  In the
          FreeBSD, NetBSD, and Solaris implementations of iconv(), this condition cannot occur either, because a
          conversion to '?' is used as a fallback.  When this condition is met, iconv()  sets  errno  to  EILSEQ
          and  returns  (size_t) -1.   *inbuf  is  left pointing to the beginning of the unconvertible multibyte
          sequence.

       •  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.

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-2008.

HISTORIAL

       glibc 2.1.  POSIX.1-2001.

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.9.1                   2 Mayo 2024                                          iconv(3)