nakayubi / zengl

Automatically exported from code.google.com/p/zengl
0 stars 0 forks source link

Unicode filenames issues with ZIP files and Delphi 2009+ #52

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The zgl_file unit contains some type casts from String to PAnsiChar. This leads 
to unexpected results with Delphi 2009+ because Strings are Unicode there. This 
is especially visible in the ZIP routines.

One way to avoid this, is to cast to an AnsiString first before casting to a 
PAnsiChar. For example, in file_openArchive, the line:

zipCurrent := zip_open( PAnsiChar( FileName), 0, error );

should be replaced with:

zipCurrent := zip_open( PAnsiChar( AnsiString(FileName)), 0, error );

because Filename is a String. Without this extra typecast, the zip_open 
function will fail.

I have found other String-to-PAnsiChar casts in:
-file_Open
-file_Exists

Original issue reported on code.google.com by bil...@planet.nl on 20 Jan 2012 at 9:57

GoogleCodeExporter commented 9 years ago
hmm, this stupid compiler just doesn't understand such typecast? O_o More and 
more I want to drop Delphi, only problems from it...

Original comment by dr.andru@gmail.com on 20 Jan 2012 at 10:12

GoogleCodeExporter commented 9 years ago
Just be glad you don't have to worry about 20 different C(++) compilers out 
there ;)

I took me quite some time too to make MondoZenGL Delphi compatible. But I guess 
you have a bigger audience if you support Delphi...

Original comment by bil...@planet.nl on 20 Jan 2012 at 11:48

GoogleCodeExporter commented 9 years ago
>> Just be glad you don't have to worry about 20 different C(++) compilers out 
there ;)

Yeah... but ZenGL have C/C++ headers, and I have already taste "happiness" of 
making compatible code between GCC and Microsoft Visual C++ :)

Original comment by dr.andru@gmail.com on 21 Jan 2012 at 10:10

GoogleCodeExporter commented 9 years ago
ZenGL will use UTF-8 encoding everywhere(UTF8String instead of String and 
AnsiString). Maybe later I will add methods with UTF-16 strings.

Original comment by dr.andru@gmail.com on 22 Jan 2012 at 5:51

GoogleCodeExporter commented 9 years ago
Looks like you needed to make a lot of changes for this. Thanks for that!

Original comment by bil...@planet.nl on 22 Jan 2012 at 6:08

GoogleCodeExporter commented 9 years ago
Yep, a lot... for Windows. But everything almost done, and since today I will 
test it :)

Original comment by dr.andru@gmail.com on 22 Jan 2012 at 6:13