[Top] [All Lists]

iconv() difference in glibc-2.[01] and glibc-2.2

To: info-inventor-dev@xxxxxxxxxxx
Subject: iconv() difference in glibc-2.[01] and glibc-2.2
From: jlim@xxxxxxxxxxxxxxxxxxxx (Jonathan Lim)
Date: Thu, 3 May 2001 18:44:10 -0700 (PDT)
Sender: owner-info-inventor-dev@xxxxxxxxxxx
I upgraded to Red Hat 7.1 recently and noticed a difference in the way iconv()
in glibc-2.2.2-10 returns the converted strings, i.e. the two-byte characters
are byte-swapped compared to before in glibc-2.[01]. The following test case
demonstrates this:

#include <stdio.h>
#include <iconv.h>

int main
( int argc,
  char *argv[] )
  char *c = new char[1];
  c[0] = 'M';
  fprintf( stderr, "%d\n", c[0] );

  char *out = new char[4];
  char *outp = out;

  size_t inb = 1;
  size_t outb = 4;

  iconv_t conCode = iconv_open( "UCS-2", "UTF-8" );
  size_t stat = iconv( conCode, &c, &inb, &outp, &outb );

  fprintf( stderr, "%d %d\n", out[0], out[1] );
  fprintf( stderr, "key = %d\n", (unsigned long) (out[0] << 8 | out[1]) );

  return 0;

I had to make some changes in SoText[23].c++ to get things to work as before.
Another thing I noticed is that the Inventor logo that normally appears in the
bottom-left of the SceneViewer window is no longer there. I have yet to look
into that.

              Jonathan Lim  _  Silicon Graphics  _  Mountain View
              GPS Graphics     Computer Systems        CA, USA

<Prev in Thread] Current Thread [Next in Thread>
  • iconv() difference in glibc-2.[01] and glibc-2.2, Jonathan Lim <=