PATCH for file name, path name under non-UTF8 locale

Sylvestre Ledru sylvestre.ledru at scilab.org
Tue Dec 30 18:17:56 CET 2008


Hello Yung-Jang,

If you don't mind, let's go public (especially since you are the author
of a great work).

I applied your patch against my source tree and I have nice directories
& files called dir_中文_other... and I didn't see any problems (except
small issues in the tests). 

I adapted your test to our unitary testing system. If you want to have a
look:
modules/fileio/tests/unit_tests/non-iso-filename.tst
[1]

I pushed everything. It is the commit
08c6212e3b3579343a63d53d2fc073bc84bcb6ec
[2]

Thanks again for your work!
Sylvestre
PS: Both URLs should work soon:
[1]
http://gitweb.scilab.org/?p=scilab.git;a=blob;f=scilab/modules/fileio/tests/unit_tests/non-iso-filename.dia.ref;h=18a8d0f698718f227885282e9a0ad22c1e4ac678;hb=a3b0fd5e61642b7fefd956a4a670e82b4a1983e4
[2]
http://gitweb.scilab.org/?p=scilab.git;a=commitdiff;h=08c6212e3b3579343a63d53d2fc073bc84bcb6ec

Le dimanche 28 décembre 2008 à 22:05 +0800, Yung-Jang Lee a écrit :
> Allan , Sylvestre :
> 
> Attached is the patch based on current master GIT to fix bugs for
> pathname and file name in Scilab commands. 
> 
> This patch contains the other small patchs  I send to you a couple of
> days before.  
> 
> I have test this patch under Winndows+zh_TW  with the following
> script . I think you may test this script with something link
> specialName='æøå' in fr_FR language.
> 
> 
> 
> Yung-Jang Lee
> 
> 
> 
> /////////////////////////////////////////////////////////////////////////////////////////
> //
> // Script to thest file name, path name of Scilab command
> //
> // set specialName with system encoding characters > 127
> //
> specialName='中文' ;// for CP950, BIG5with character code > 127
> // specialName='æøå'; // for fr_FR
> dirName    ='dir_'+specialName;
> fileName   ='file_'+specialName;
> fileWithExt='file_'+specialName+'.ext';
> 
> // 1.
> // test mkdir, createdir,cd
> //
> mkdir(dirName);
> createdir(dirName+'_other');
> cd(dirName);
> 
> // 2.
> //fix bug in  sci_getcwd, for pwd and getcwd
> //
> pwd; //<-------fail, call getcwd
> getcwd();//<---fail call  scigetcwd
> // 3.
> // test mopen
> //
> fd=mopen(fileName,'w');mclose(fd);// ok 
> //4.
> // copyfile (host,unix)
> copyfile(fileName,fileWithExt)
> copyfile(fileName,'../'+dirName+'_other')
> //5
> // mputl, mfprintf
> //
> mputl([specialName+'1';specialName+'2'],fileName+'_mputl');
> mfprintf(fileName+'_mfprintf','%s %f',specialName+'3',%pi); 
> //6
> // Fortran style open/close 
> // filename fixed, but string in fortran file still in UTF encoding
> //
> fd=file('open',fileName+'_open','new') ; fprintf(fd,'%s %
> f',specialName+'3',%pi); file('close',fd);
> fprintf(fileName+'_fprintf','%s %f',specialName+'3',%pi); 
> fprintfMat(fileName+'_Mat',[11,12;21,22],'%5.2f',specialName
> +'_fprintfMat Test');
> //7
> //  findfiles.c
> //
> ls()//
> listfiles() //
> dir() //
> findfiles('.','*') 
> ls('../'+dirName) //
> listfiles('../'+dirName) //
> dir('../'+dirName) //
> findfiles('.','*'+specialName+'.*') 
> //8
> // test getshortpathname,getlongpathname
> //
> sname=getshortpathname(fileName)
> lname=getlongpathname(sname);
> //9
> // test deletefile, removedir
> //
> deletefile(fileWithExt);  // 
> removedir('../'+dirName+'_other');
> ///////////////////////////////////////////////////////////////////////////




More information about the dev mailing list