Hello,
Our Teamsite environment : 6.1.0 Service Pack 2 on Windows 2003.
We recently created a branch in Teamsite which has directories/filenames with portuguese characters. Now I am having issues with the perl script (edited version of
http://devnet.interwoven.com/site.fcgi/techlib/52656 ). The script works perfectly for filenames which have normal ascii characters. Now we have problems after we created a dct type with portuguese character.
This is the relevant portion of my code with encoding related changes for portuguese characters.
#!d:\iw-home/iw-perl/bin/iwperl
use CGI;
use TeamSite::Config;
use Encode;
my $cgi = new CGI;
# extract the file name selected for uploading
my $filename = $cgi->param("filename");
my $uploadFileHandle = $cgi->param("filename");
my $iwmount = TeamSite::Config::iwgetmount();
$filename =~ s/.*[\/\\](.*)/$1/;
my $apath = $cgi->param("areaPath");
$apath =~ s|^//[^/]+|$iwmount|;
$apath =~ s|^http://[^/]+|$iwmount|;
$apath =~ s|/|\\|g;
my $dcr_type = $cgi->param("dcrType");
my $uploadDir = $apath.$dcr_type."\\";
$uploadDir = Encode::decode("utf8", $uploadDir);
my $prtstr = "Y:\\default\\main\\bfe_portal\\bfe_news
\\WORKAREA\\folder\\notícias_internas-internal_news\\" ;
# $uploadDir = $prtstr;
unless (open(TESTFILE, "<$uploadDir$filename"))
{
open(UPLOADFILE, ">$uploadDir$filename");
# both files must be in binary mode
binmode(UPLOADFILE);
binmode($uploadFileHandle);
# read from the source file and write to the target file
while(<$uploadFileHandle>)
{
print UPLOADFILE $_;
}
close UPLOADFILE;
# upload process complete, provide some feedback to the user
print $cgi->header();
ShowSuccess();
exit 0;
}
I have tried "cp860", "iso-8859-2" etc.. in place of utf8 in the following line of the code
$uploadDir = Encode::decode("utf8", $uploadDir);
but with no success.
What is surprising is that when I try to hardcode the filename with portuguese character as shown in the code -- variable $prtstr, I am properly able to open the file using the perl open function and my file gets uploaded. I have compared by displaying the passed $uploadDir and $prtstr in the internet explorer and they are the same. I would really appreciate any inputs or pointers with regards to this issue.