X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FXfer%2FSmb.pm;h=f3b5cfdfbe769c70bcfc2bcc6882ce8ab178b4cf;hp=c9242f4a0448089739200cb64e9d93c9341ced5d;hb=fadae1eaa5482a441bc8e8aa829a063ee6a5f0c0;hpb=4cdaa6b8a9f5161ee2da4371d68cbbad41248ea0 diff --git a/lib/BackupPC/Xfer/Smb.pm b/lib/BackupPC/Xfer/Smb.pm index c9242f4..f3b5cfd 100644 --- a/lib/BackupPC/Xfer/Smb.pm +++ b/lib/BackupPC/Xfer/Smb.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.1.0beta0, released 3 Sep 2007. # # See http://backuppc.sourceforge.net. # @@ -38,6 +38,7 @@ package BackupPC::Xfer::Smb; use strict; +use Encode qw/from_to encode/; sub new { @@ -111,12 +112,16 @@ sub start $t->{fileIncludeHash} = {}; if ( defined($conf->{BackupFilesOnly}{$t->{shareName}}) ) { foreach my $file ( @{$conf->{BackupFilesOnly}{$t->{shareName}}} ) { + $file = encode($conf->{ClientCharset}, $file) + if ( $conf->{ClientCharset} ne "" ); push(@fileList, $file); $t->{fileIncludeHash}{$file} = 1; } } elsif ( defined($conf->{BackupFilesExclude}{$t->{shareName}}) ) { foreach my $file ( @{$conf->{BackupFilesExclude}{$t->{shareName}}} ) { + $file = encode($conf->{ClientCharset}, $file) + if ( $conf->{ClientCharset} ne "" ); push(@fileList, $file); } # @@ -151,6 +156,8 @@ sub start X_option => $X_option, timeStampFile => $timeStampFile, }; + from_to($args->{shareName}, "utf8", $conf->{ClientCharset}) + if ( $conf->{ClientCharset} ne "" ); $smbClientCmd = $bpc->cmdVarSubstitute($smbClientCmd, $args); if ( !defined($t->{xferPid} = open(SMB, "-|")) ) { @@ -193,6 +200,8 @@ sub start return; } my $str = "Running: " . $bpc->execCmd2ShellCmd(@$smbClientCmd) . "\n"; + from_to($str, $conf->{ClientCharset}, "utf8") + if ( $conf->{ClientCharset} ne "" ); $t->{XferLOG}->write(\$str); alarm($conf->{ClientTimeout}); $t->{_errStr} = undef; @@ -229,6 +238,9 @@ sub readOutput # alarm($conf->{ClientTimeout}) if ( !$t->{abort} ); $t->{lastOutputLine} = $_ if ( !/^$/ ); + + from_to($_, $conf->{ClientCharset}, "utf8") + if ( $conf->{ClientCharset} ne "" ); # # This section is highly dependent on the version of smbclient. # If you upgrade Samba, make sure that these regexp are still valid.