[delphizip] Re: error when reading a zip file in another PC

  • From: James Turner <james.d.h.turner@xxxxxxxxxxxx>
  • To: delphizip@xxxxxxxxxxxxx
  • Date: Tue, 24 Jul 2007 10:38:37 +0100

If corruption results from codepage conversions, ultimately, those 
conversions will have to be corrected or eliminated. It sounds as though 
correction is likely to be impossible, so that leaves elimination.

Perhaps you could validate conversions (by reversing and comparing with 
the original) - that way, you could at least detect conversion errors 
and issue a meaningful error message.

Perhaps you could save the original filename (raw) in the ExtraData of 
the file. This will be valid provided unzipping occurs on a similar 
computer (but would be a lot of work and doesn't address the immediate 
problem).

-- James Turner

Edwin wrote:
> Hi Russell Peters,
> According to the further study, I think you are right, it most likely that 
> the problem is some characters in the path cannot be converted, i.e. some 
> traiditional chinese cannot be converted into simplified Chinese.......
>
> What u can think I can solve the prolbem? How great the ZipMaster supports 
> unicode...
>
>
>
>
> Best Regards,
> Edwin
> http://www.innovationgear.com
> MindVisualizer -- Productive Visual Mind Mapping Software 
> 2007-07-24
>
>
>
> Sender£º RPeters
> Sent£º 2007-07-11 19:14:21
> Recipient£º delphizip@xxxxxxxxxxxxx
> CC£º 
> Subject£º [delphizip] Re: error when reading a zip file in another PC
>
> The big problem may be what it does with characters that will not (or
> cannot) convert - often these result in an invalid character as far as =
> paths
> or filenames are concerned.
>
> A reasonably easy test is to call FindFirst and check the Windows error
> (probably bad filespec - I cannot recall the exact error codes at the
> moment).
>
> - Russell Peters
>   
>> -----Original Message-----
>> From: delphizip-bounce@xxxxxxxxxxxxx [mailto:delphizip-
>> bounce@xxxxxxxxxxxxx] On Behalf Of Edwin
>> Sent: Wednesday, 11 July 2007 7:47 PM
>> To: delphizip@xxxxxxxxxxxxx; delphizip@xxxxxxxxxxxxx
>> Subject: [delphizip] Re: error when reading a zip file in another PC
>> =20
>> Thanks for your info James.
>> I use Tntsystem.WideStringToStringEx(str, DefaultSystemCodePage) to do
>> the conversion, it internally calls WideCharToMultiByte. Not sure =
>>     
> where
>   
>> the problem comes from, Tntsystem.WideStringToStringEx works well
>> elsewhere so far.............
>> =20
>> =20
>> =20
>> =20
>> Best Regards,
>> Edwin
>> http://www.innovationgear.com
>> MindVisualizer -- Productive Visual Mind Mapping Software
>> 2007-07-11
>> =20
>> =20
>> =20
>> Sender=A3=BA James Turner
>> Sent=A3=BA 2007-07-11 17:32:40
>> Recipient=A3=BA delphizip@xxxxxxxxxxxxx
>> CC=A3=BA
>> Subject=A3=BA [delphizip] Re: error when reading a zip file in another =
>>     
> PC
>   
>> =20
>> Using the short filename **might** work since it probably has only
>> ascii
>> characters (never checked this).
>> =20
>> Are you using standard Delphi conversions or working with
>> MultibyteToWideChar and WideCharToMultibyte directly?
>> =20
>> If you use the style ES_OEMCONVERT in any editboxes, this might
>> generate
>> a conversion problem (never studied this).
>> =20
>> -- James Turner
>> =20
>> Edwin wrote:
>>  > Do you mean call GetShortPathName before setting the value of the
>> ZipFileName property? The path name and file name that the user
>> reported did not exceed the max. 255 characters.
>>  > BTW, since I use WideString as much as I can in the program, the =
>>     
> path
>   
>> name is converted from WideString to string before assigning to the
>> property TZipMaster.ZipFileName, using the routines in the TNT =
>>     
> Controls
>   
>> package, I'm not sure is there error in the conversion....
>>  >
>>  >
>>  >
>>  >
>>  > Best Regards,
>>  > Edwin
>>  > http://www.innovationgear.com
>>  > MindVisualizer -- Productive Visual Mind Mapping Software
>>  > 2007-07-11
>>  >
>>  >
>>  >
>>  > Sender=A3=BA James Turner
>>  > Sent=A3=BA 2007-07-09 19:16:49
>>  > Recipient=A3=BA delphizip@xxxxxxxxxxxxx
>>  > CC=A3=BA
>>  > Subject=A3=BA [delphizip] Re: error when reading a zip file in =
>>     
> another PC
>   
>>  >
>>  > It's just a guess, but perhaps using the short filename would help.
>>  >
>>  > This can be found using the API function GetShortPathName. On some
>>  > versions of Windows, it can be found from the property sheet.
>>  >
>>  > -- James Turner
>>  >
>>  > RPeters wrote:
>>  >
>>  >  > I would say it is quite likely.
>>  >  > My understanding is that the UNC 'share name' still follows the =
>>     
> old
>   
>>  >  > restricted character rules - if I am wrong I will quite a bit of
>> code to
>>  >  > adapt.
>>  >  >
>>  >  > I doubt that 1.79 (or earlier) is very friendly with MBCS
>> characters either.
>>  >  > If you are using 1.79 you could have it generate a log file (put =
>>     
> an
>   
>>  >  > appropriate ini file in the same folder as the dll).
>>  >  > - Russell Peters
>>  >  >
>>  >  >
>>  >  >  > -----Original Message-----
>>  >  >  > From: delphizip-bounce@xxxxxxxxxxxxx [mailto:delphizip-
>>  >  >  > bounce@xxxxxxxxxxxxx] On Behalf Of Edwin
>>  >  >  > Sent: Monday, 9 July 2007 6:54 PM
>>  >  >  > To: delphizip@xxxxxxxxxxxxx
>>  >  >  > Subject: [delphizip] error when reading a zip file in another PC
>>  >  >  >
>>  >  >  > Dear sir/Madam,
>>  >  >  >
>>  >  >  > Error when reading a zip file which is located in another PC and
>> the
>>  >  >  > UNI path reads like \\pc1\folder1\my_file.zip, where folder1
>> contains
>>  >  >  > Chinese characters.  This error is reported by one of my users
>> and I
>>  >  >  > cannot reproduce this error in my office. Any tips would be
>>  >  >  > appreciated.
>>  >  >  >
>>  >  >  > BTW, Is the archive of this list available?
>>  >  >  > --------------
>>  >  >  > Best Regards,
>>  >  >  > Edwin
>>  >  >  > http://www.innovationgear.com
>>  >  >  > MindVisualizer -- Productive Visual Mind Mapping Software
>>  >  >  > 2007-07-09
>>  >  >  >
>>  >  >  > -----------
>>  >  >  > To unsubscribe from this list, send an empty e-mail
>>  >  >  > message to:
>>  >  >  >   delphizip-request@xxxxxxxxxxxxx
>>  >  >  > and put the word unsubscribe in the subject.
>>  >  >  >
>>  >  >  > __________ NOD32 2384 (20070708) Information __________
>>  >  >  >
>>  >  >  > This message was checked by NOD32 antivirus system.
>>  >  >  > http://www.eset.com
>>  >  >  >
>>  >  >  >
>>  >  > -----------
>>  >  > To unsubscribe from this list, send an empty e-mail
>>  >  > message to:
>>  >  >   delphizip-request@xxxxxxxxxxxxx
>>  >  > and put the word unsubscribe in the subject.
>>  >  >
>>  >  >
>>  >  >
>>  > -----------
>>  > To unsubscribe from this list, send an empty e-mail
>>  > message to:
>>  >   delphizip-request@xxxxxxxxxxxxx
>>  > and put the word unsubscribe in the subject.
>>  >
>>  >
>>  > -----------
>>  > To unsubscribe from this list, send an empty e-mail
>>  > message to:
>>  >   delphizip-request@xxxxxxxxxxxxx
>>  > and put the word unsubscribe in the subject.
>>  >
>>  >
>> -----------
>> To unsubscribe from this list, send an empty e-mail
>> message to:
>>   delphizip-request@xxxxxxxxxxxxx
>> and put the word unsubscribe in the subject.
>> =20
>> =20
>> -----------
>> To unsubscribe from this list, send an empty e-mail
>> message to:
>>   delphizip-request@xxxxxxxxxxxxx
>> and put the word unsubscribe in the subject.
>> =20
>> __________ NOD32 2392 (20070711) Information __________
>> =20
>> This message was checked by NOD32 antivirus system.
>> http://www.eset.com
>>     
>
>
> -----------
> To unsubscribe from this list, send an empty e-mail 
> message to:
>   delphizip-request@xxxxxxxxxxxxx 
> and put the word unsubscribe in the subject.
>
>
> -----------
> To unsubscribe from this list, send an empty e-mail 
> message to:
>   delphizip-request@xxxxxxxxxxxxx 
> and put the word unsubscribe in the subject.
>
>   
-----------
To unsubscribe from this list, send an empty e-mail 
message to:
  delphizip-request@xxxxxxxxxxxxx 
and put the word unsubscribe in the subject.

Other related posts: