Στις 4/7/2012 11:02, ο/η Massimo Manghi έγραψε:
On 2012-07-03 20:17, Georgios Petasis wrote:
Hi all,

I have written a small tcl client that uploads an XML file, using
code from the wiki:

http://wiki.tcl.tk/13675

The url is a Rivet tcl script,  and I have used "xml" as the "form
field". The Rivet script contains code like:

if {![var exists xml]} {
  ::entityBuster returnErrorPage "No XML posted!"
}

set xmldata [upload data xml]

I see that there is data placed in xmldata (no matter how many times
I call "upload data"), but what is the encoding of the data?


An excerpt taken from rfc1867 "Form-based File Upload in HTML" (chapter 7)

"Each part may be encoded and the "content-transfer-encoding" header
 supplied if the value of that part does not conform to the default
 encoding."


Rivet has no support for returning this specific header value of a multipart
message AFAIK.
It doesn't matter, it seems that the following works:

set xmldata [upload data xml]
set xmldata [encoding convertfrom utf-8 $xmldata]

The problem was that I failed to change the stdout encoding to utf-8 in my rivet string. Adding "fconfigure stdout -encoding utf-8" ate the very top of my script, solved all problems. (I return everything in utf-8 and set the utf-8 encoding in all return types).

George


I tried both "encoding convertfrom utf-8" & "encoding converttoo
utf-8", but I do not seem to get back valid utf-8.
The original file is in utf-8.


what does the raw data look like?

 -- Massimo


---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscr...@tcl.apache.org
For additional commands, e-mail: rivet-dev-h...@tcl.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscr...@tcl.apache.org
For additional commands, e-mail: rivet-dev-h...@tcl.apache.org

Reply via email to