Changeset 4925
- Timestamp:
- 10/29/09 08:48:20 (4 weeks ago)
- Location:
- branches/greyhound/lib/MT
- Files:
-
- 3 modified
-
FileMgr/Local.pm (modified) (1 diff)
-
Util/Archive/Tgz.pm (modified) (2 diffs)
-
Util/Archive/Zip.pm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/greyhound/lib/MT/FileMgr/Local.pm
r4196 r4925 20 20 21 21 sub _syserr { 22 return $_[0] if $^O ne 'MSWin32'; 23 return Encode::decode('Shift_JIS', $_[0]) unless Encode::is_utf8($_[0]); 24 $_[0]; 22 if ( $^O eq 'MSWin32' ) { 23 return Encode::is_utf8($_[0]) ? $_[0] 24 : Encode::decode('Shift_JIS', $_[0]) 25 ; 26 } 27 else { 28 return Encode::is_utf8($_[0]) ? $_[0] 29 : Encode::decode_utf8($_[0]) 30 ; 31 } 25 32 } 26 33 -
branches/greyhound/lib/MT/Util/Archive/Tgz.pm
r4726 r4925 117 117 $path ||= MT->config->TempDir; 118 118 for my $file ( $obj->files ) { 119 my $file_enc = MT::FileMgr::Local::_syserr( $file );119 my $file_enc = Encode::decode_utf8( $file ); 120 120 my $f = File::Spec->catfile( $path, $file_enc ); 121 121 $obj->{_arc}->extract_file( $file, MT::FileMgr::Local::_local( $f ) ); … … 129 129 return $obj->error(MT->translate('Can\'t write to the object')) 130 130 if 'r' eq $obj->{_mode}; 131 $file_path = Encode::encode_utf8($file_path) 132 if Encode::is_utf8($file_path); 131 133 my $filename = 132 134 File::Spec->catfile( $path, $file_path ); -
branches/greyhound/lib/MT/Util/Archive/Zip.pm
r4726 r4925 21 21 return $pkg->error(MT->translate('Type must be zip')) 22 22 unless $type eq ARCHIVE_TYPE; 23 23 24 24 my $zip = Archive::Zip->new; 25 25 my $obj = { _flushed => 0, _arc => $zip }; … … 101 101 $path ||= MT->config->TempDir; 102 102 for my $file ( $obj->files ) { 103 my $file_enc = MT::FileMgr::Local::_syserr($file );103 my $file_enc = Encode::decode('Shift_JIS', $file ); 104 104 my $f = File::Spec->catfile( $path, $file_enc ); 105 105 $obj->{_arc}->extractMember( $file, MT::FileMgr::Local::_local( $f ) ); … … 115 115 my $filename = 116 116 File::Spec->catfile( $path, $file_path ); 117 $file_path = Encode::encode('Shift_JIS', $file_path) 118 if Encode::is_utf8($file_path); 117 119 $obj->{_arc}->addFile( $filename, $file_path ); 118 120 } … … 125 127 return $obj->error(MT->translate('Both data and file name must be specified.')) 126 128 unless $string && $file_name; 127 129 $file_name = Encode::encode('Shift_JIS', $file_name) 130 if Encode::is_utf8($file_name); 128 131 $obj->{_arc}->addString($string, $file_name); 129 132 }
