Howdy,

Looking at the code, ns_returnfile passes the filename through to the core 
Ns_ConnReturnFile without any of the care that core Tcl does handling 
filenames.  You may be able to replace ns_returnfile with ns_returnfp, passing 
a file handle returned from Tcl's open command which should be smarter with 
filesystem encoding.

The downside is that would bypass some of the smarts within the underlying 
Ns_ConnReturnFile used by ns_returnfile:  It appears to set Last-Modified 
headers, optionally cache small files, mmap large files, etc.  All this may not 
matter if you're doing one-shot type work, e.g., returning a custom crafted 
file for just one user, just once.

-Jim




On Sep 22, 2011, at 3:27 PM, Peter Sadlon wrote:

> Just a guess here, but by default, TCL is compiled with Latin-1 encoding.  
> This causes some issues when you are trying to do certain things in utf-8, 
> even if you set all possible TCL config variables to use the UTF-8 charset.  
> You could attempt to recompile TCL with 
> 
> 
> --with-encoding utf-8
> 
> 
> But in the end, your final comment is correct, it is best to encode the 
> filename, then you don't have to worry about a bunch of special cases.
> 
> 
> 
> 
> 
> Date: Thu, 22 Sep 2011 22:59:02 +0200
> From: [email protected]
> Subject: [AOLSERVER] Fwd: AOLserver 4.5.0 - ns_returnfile does not find file 
> - file name contains special chars
> To: [email protected]
> 
> Hi all 
> at ]project-open[ we currently use AOLserver 4.5.0 with OpenACS 
> 5.6.0 on CentOS release 5.3 (Final)
> 
> We suddenly encountered the problem that ns_returnfile can't find a
> file which filname contains special chars such as 'umlaute'
> (ä, ö, etc.)
> 
> ---
> convmv tells me that the file name is utf-8 encoded.
> ---
> 
> Config.tcl has the standard settings:
> 
> ns_param   HackContentType    1
> ns_param   DefaultCharset     utf-8
> ns_param   HttpOpenCharset    utf-8
> ns_param   OutputCharset      utf-8
> ns_param   URLCharset         utf-8
> 
> ---
> Following CentOS locale:
> 
> LANG=en_US.UTF-8
> LC_CTYPE="en_US.UTF-8"
> LC_NUMERIC="en_US.UTF-8"
> LC_TIME="en_US.UTF-8"
> LC_COLLATE="en_US.UTF-8"
> LC_MONETARY="en_US.UTF-8"
> LC_MESSAGES="en_US.UTF-8"
> LC_PAPER="en_US.UTF-8"
> LC_NAME="en_US.UTF-8"
> LC_ADDRESS="en_US.UTF-8"
> LC_TELEPHONE="en_US.UTF-8"
> LC_MEASUREMENT="en_US.UTF-8"
> LC_IDENTIFICATION="en_US.UTF-8"
> LC_ALL=
> 
> ---
> File System is 'ext3'
> ---
> Files have been created with " exec /bin/cp $filename $dest_path" out of
> a tcl file or using 'touch/emacs' on OS level. Same results.  
> ---
> 
> We did have the problems using AOLserver 3.3
> Anybody an idea what the cause might be?
> 
> Probably its better to always encode file names of 
> uploaded filesto avoid trouble when creating multi-plattform 
> applications. 
> 
> Thanks for your support!
> 
> Klaus 
> 
> 
>  
> --
> AOLserver - http://www.aolserver.com/
> 
> To Remove yourself from this list, simply send an email to 
> <[email protected]> with the
> body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
> field of your email blank.
> 
> --
> AOLserver - http://www.aolserver.com/
> 
> To Remove yourself from this list, simply send an email to 
> <[email protected]> with the
> body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
> field of your email blank.



--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to 
<[email protected]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to