On Fri, 4 Sep 2020 10:31:53 +0200
Zoran Vasiljevic <z...@archiware.com> wrote:

> Hi!    
Hi!

> What is the purpose of signalling the binary content way up from the
> command line? For this we have the Ns_IsBinaryMimeType(cType) test.
>  

Sometimes we have to deal with misconfigured legacy sites, which transmit data 
in 8-bit encoding and report "Content-Type: text/plain" without specifying 
charset. Such data will be broken, since it will be processed ns_http as utf-8.

Receiving binary content in this case will allow us to correctly recover data 
using 'encoding convertfrom' command 

>     
> > Sometimes converted strings become
> > corrupted. For example, there is a server with output encoding
> > iso-8859-2      
> 
> This is I guess out of the scope as we rely on Tcl to do 
> encoding conversions. So if this comes bad, then you must
> post a bug to the Tcl project.    

As far as I understand, this is not a Tcl problem.

ns_http uses Tcl_NewStringObj for nonbinary data received, even for 8-bit chars.
Input data for Tcl_NewStringObj must be correct utf-8 string. An 8-bit string 
is not.
For 8-bit strings, we must either use Tcl_NewByteArrayObj or prepare the utf-8 
string using Tcl_ExternalToUtf before Tcl_NewStringObj .


Oleg.


_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to