rem: doc = xmlParseFile ( tempname );
add: doc = utf8_xmlParseFile ( tempname );
context: xmlDocPtr parse_gnucash_file ( gchar * filename ){  gchar buffer[1024], *tempname;  FILE * filein, * tempfile;  xmlDocPtr doc;  filein = fopen ( filename, "r" );  if ( ! filein )    {      fprintf (stderr, "ERROR");      return NULL;    }  tempname = g_strdup_printf ( "gsbgnc%05d", g_random_int_range (0,99999) );  tempfile = fopen ( tempname, "w+x" );  if ( ! tempfile )    {      fprintf (stderr, "ERROR");      return NULL;    }  while ( fgets ( buffer, 1024, filein ) )    {      gchar * tag;      tag = g_strrstr ( buffer, "<gnc-v2>" );            if ( tag )	{	  gchar * ns[14] = { "gnc", "cd", "book", "act", "trn", "split", "cmdty", 			     "ts", "slots", "slot", "price", "sx", "fs", NULL };	  gchar ** iter;	  /* We need to fix the file */	  tag += 7;	  *tag = 0;	  tag++;	  fputs ( buffer, tempfile );	  for ( iter = ns ; *iter != NULL ; iter++ )	    {	      fputs ( g_strdup_printf ( "  xmlns:%s=\"http://www.gnucash.org/lxr/gnucash/source/src/doc/xml/%s-v1.dtd#%s\"\n", 					*iter, *iter, *iter ),		      tempfile );	    }	  fputs ( ">\n", tempfile );	}      else	{	  fputs ( buffer, tempfile );	}    }  fclose ( filein );  fclose ( tempfile );  doc = xmlParseFile ( tempname );  unlink ( tempname );    return doc;}