Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicode filenames support in zip_util_pkg #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions ora/zip_util_pkg.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ is
t_now date;
t_blob blob;
t_clen integer;
t_name raw(32767);
begin
t_now := sysdate;
t_blob := utl_compress.lz_compress( p_content );
Expand All @@ -359,12 +360,16 @@ is
, true
);
end if;
t_name := utl_raw.cast_to_raw(convert(p_name, 'AL32UTF8'));
dbms_lob.append
( p_zipped_blob
, utl_raw.concat
( hextoraw( '504B0304' ) -- Local file header signature
, hextoraw( '1400' ) -- version 2.0
, hextoraw( '0000' ) -- no General purpose bits
, case when convert(p_name, 'AL32UTF8') = convert(p_name, 'US8PC437')
then hextoraw( '0000' ) -- no General purpose bits
else hextoraw( '0008' ) -- set Language encoding flag (EFS)
end
, hextoraw( '0800' ) -- deflate
, little_endian
( to_number( to_char( t_now
Expand Down Expand Up @@ -397,11 +402,11 @@ is
, little_endian( t_clen - 18 ) -- compressed size
, little_endian( dbms_lob.getlength( p_content ) )
-- uncompressed size
, little_endian( length( p_name )
, little_endian( utl_raw.length( t_name )
, 2
) -- File name length
, hextoraw( '0000' ) -- Extra field length
, utl_raw.cast_to_raw( p_name ) -- File name
, t_name -- File name
)
);
dbms_lob.copy( p_zipped_blob
Expand Down