[PATCH] for UTF-16 output (was Re: [xml] UTF16 output broken in 2.5.8 (WIN32)?)



Hi Daniel,

I've changed the three occurances of fopen (..., "w") in
xmlio.c to fopen (..., "wb"). 

The problem of no output all was indeed related to 
character encoding name. Without iconv, libxml2
will accept UTF-16LE or UTF-16BE but not UTF-16.

Interestingly iconv interprets UTF-16 as UTF-16BE, I
would have expected "UTF-16 matching platform
architecture", i.e. UTF-16LE on Intel.

Regards,
Peter Jacobi


*** old\xmlio.c Sat Jul 05 22:37:46 2003
--- xmlio.c     Sat Jul 19 11:44:47 2003
***************
*** 395,401 ****
      if (path == NULL)
        return(NULL);
  
!     fd = fopen(path, "w");
      return((void *) fd);
  }
  
--- 395,401 ----
      if (path == NULL)
        return(NULL);
  
!     fd = fopen(path, "wb");
      return((void *) fd);
  }
  
***************
*** 1265,1271 ****
            if ( dump_name != NULL ) {
                (void)snprintf( buffer, sizeof(buffer), "%s.content", dump_name );
  
!               tst_file = fopen( buffer, "w" );
                if ( tst_file != NULL ) {
                    xmlGenericError( xmlGenericErrorContext,
                        "Transmitted content saved in file:  %s\n", buffer );
--- 1265,1271 ----
            if ( dump_name != NULL ) {
                (void)snprintf( buffer, sizeof(buffer), "%s.content", dump_name );
  
!               tst_file = fopen( buffer, "wb" );
                if ( tst_file != NULL ) {
                    xmlGenericError( xmlGenericErrorContext,
                        "Transmitted content saved in file:  %s\n", buffer );
***************
*** 1276,1282 ****
                }
  
                (void)snprintf( buffer, sizeof(buffer), "%s.reply", dump_name );
!               tst_file = fopen( buffer, "w" );
                if ( tst_file != NULL ) {
                    xmlGenericError( xmlGenericErrorContext,
                        "Reply content saved in file:  %s\n", buffer );
--- 1276,1282 ----
                }
  
                (void)snprintf( buffer, sizeof(buffer), "%s.reply", dump_name );
!               tst_file = fopen( buffer, "wb" );
                if ( tst_file != NULL ) {
                    xmlGenericError( xmlGenericErrorContext,
                        "Reply content saved in file:  %s\n", buffer );


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]