🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
2 messages
2 total messages Started by Unknown Sat, 17 Jul 2010 03:35
--
#241730
Author: Unknown
Date: Sat, 17 Jul 2010 03:35
58 lines
3682 bytes
<PRE>
unLike Info·Zip, 7Zip archives UTF·8 paths/file·names; e.g.:
“ 7z.EXE A -sccUTF-8 -ssw  Something.ZIP  @UTF·8·List·of·files.TXT ”.

Both 7Zip and Info·Zip are cost·free, but 7Zip is more Windows aware.
A 7Zip bug:

  Wildcarding ( e.g. “*.TXT” ) a folder means there'll be no
  warnings for files not found there ( e.g. “No·Such·File.CPP” ).

Below, is an example ( from <A hRef="http://jeffrelf.f-m.fm/X.CPP">X.CPP, Visual C++</A> ) of how to run a DOS app
with no window popping up, ever ( output is re·directed ).

  ClearScreen, SetCurrentDirectory( Home ), gDate(0);
  LnP  Result·TXT = L"Bac\\Result.TXT", Result·ZIP = _T, Command·Line = _T ;
  Command·Line += Str( Result·ZIP, L"Bac\\%d_%s·%d.ZIP", Year, Month, Day ) + 2 ;
  
  //  Backup·TXT has my list of files to backup,
  //  one per line, in UTF·8; the UTF·8 sig isn't allowed.
  Str( Command·Line, L"7z A -sccUTF-8 -ssw  %s  @%s", Result·ZIP, Backup·TXT );
  PROCESS_INFORMATION Stat = {};  STARTUPINFO SU ={ sizeof( STARTUPINFO ) };
  SECURITY_ATTRIBUTES Inherit = { sizeof( SECURITY_ATTRIBUTES ) };
  //  Can't use fopen(), “bInheritHandle” must be “true”.
  Inherit.bInheritHandle = 1 ;
  
  SU.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW,
  //  Here, “SW_HIDE” means the window never appears, not for an instant.
  SU.wShowWindow = SW_HIDE ;
  
  //  Result·TXT will have 7Zip's results, in UTF·8(no sig),
  //  including warnings.
  SU.hStdOutput = CreateFile( Result·TXT, GENERIC_WRITE, 0, &Inherit, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0 );

  if ( !CreateProcess( 0, Command·Line, 0,0,1,0,0,0, &SU , &Stat ) )
    Sh( L"“ %s ” Failed.", Command·Line );
  else WaitForSingleObject( Stat.hProcess, INFINITE ),
       CloseHandle( Stat.hProcess ), CloseHandle( Stat.hThread );
  CloseHandle( SU.hStdOutput );
  
  FILE *fp = fopen( Result·TXT, L"rb" );
  if ( !fp ) Sh( L"“ %s ” didn't open(Read).", Result·TXT );
  else {
  
    //  “_T” is large ( 1,600 bytes ), “B·Sh·” is huge ( 512 * 1024 bytes ).
    _Sz = fread( _B = _LnP( B·Sh· ), 1, filelength( fileno( fp ) ), fp ),
    fclose( fp );
    _E = _B + _Sz, *_E = 0, B = P = LnP( _E + ( int( _E ) & 1 ) + 4 );
    
    //  Make it(Result·TXT) UTF·16
    Sz = MultiByteToWideChar( CP_UTF8, 0, __LnP( _B ), -1, B, mxWcharSh );
    E = B + Sz, *E = 0 ;
    while( P = Find( 0, B = P ), *P++ = 0, Ch·Found ) { While( Ch <=32 );
      if ( D = Pat·In·Str( L" WARNING:", B ) )
        //  Announce the warnings, nothing else.
        D -= LenPat + 3, *D = 0, Sh( L"“ %s ” didn't open(Read).", B );  }
    Sh( L"“ %s ” updated.", Result·ZIP );  }
    
  SetCurrentDirectory( X·Dir ); goto  nxEvent ;
--
#241737
Author: Unknown
Date: Sat, 17 Jul 2010 11:39
11 lines
1575 bytes
<PRE>
By the way, only the latest beta of 7-Zip ( 7z.EXE, 9.15 )
archives UTF·8 paths/file·names, not the “stable release”.

And, to browse the resulting .ZIP file, you must use the latest “7zFM.EXE“.
Window·7's .ZIP browser ( Win Explorer ) fails to handle Unicode file names.

Likewise, Win7's FTP browser ( Win Explorer ) fails to handle Unicode file names,
it displays UTF·8 like it was Windows·1252.

For easy access ( in a DOS box ) I plopped 7z.EXE into “C:\Windows”.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads