etrapani> With the very same file, the iconv output is different under
    etrapani> FreeBSD and Linux (both on Intel PIII).  I don't want to find
    etrapani> the cause of the difference (version numbers would helpful if
    etrapani> that where the case), rather I want to know which output is the
    etrapani> right one according to specs or common sense or even both :).

Assuming the characters are being shown byte-swapped, the FreeBSD output is
correct. Byte Order Mark's (BOM's) should be produced for all UTF-16 text.

This short segment of code shows how to determine if the text needs to be byte
swapped.

  FILE *in;
  int byte_swap;
  unsigned short bom;

  fread((char *) &bom, sizeof(unsigned short), 1, in);

  byte_swap = (bom == 0xfffe) ? 1 : 0;
-----------------------------------------------------------------------------
Mark Leisher
Computing Research Lab            Cinema, radio, television, magazines are a
New Mexico State University       school of inattention: people look without
Box 30001, Dept. 3CRL             seeing, listen without hearing.
Las Cruces, NM  88003                            -- Robert Bresson
-
Linux-UTF8:   i18n of Linux on all levels
Archive:      http://mail.nl.linux.org/lists/

Reply via email to