Problem with POST & getting the data...

27 views
Skip to first unread message

Georgios Petasis

unread,
Nov 29, 2011, 11:09:35 AM11/29/11
to Wub Discussion
Hi all,

I have a Nub domain, that creates a small form with a text area, aiming
at receiving utf-8 data through POST.

However, it seems that the server does not set the proper encoding
during the post transaction, and the transaction encoding ends to be
"binary" (as I can see from the -encoding value of the request dict the
domain method receives).

How can I create my form to ensure that utf-8 will be used?
Currently, the form code is:

<form> defaultForm action process method post \
accept "text/plain; charset=utf-8" accept-charset utf-8 enctype
"multipart/form-data" {
[<fieldset> details vertical 1 {
[<legend> "Simple form for testing \"$application\"!"]\
[<textarea> text rows 16 accept "text/plain; charset=utf-8" \
title "Paste some text here, to be send to the application"
$text]
[<text> key label "Access Key:" \
title "Your Product Key for accessing the application" $key]\
[<submit> submit Submit] [<hidden> browser 1]
}]
}

George

Colin McCormack

unread,
Nov 30, 2011, 2:27:59 AM11/30/11
to wub-dis...@googlegroups.com, Georgios Petasis
Hi George,

I may have to do a bit more research, but multipart/form-data is its own
encoding defined by RFC2388, and I don't *think* accept or
accept-charset are needed or are helpful here. multipart/form-data will
present its content in a MIME encapsulated form, kinda, and from memory
there's an escape encoding defined for its content.

As RFC2388 defines its own encoding, it's right that the server should
read it in binary, I think, as the server has to then break the stream
into component parts.

Now, how to specify for each element in the form which character
encoding to use ... that I will have to think about. The browser
doesn't specify it automatically? There is an ugly ancient hack
('documented' here: https://bugzilla.mozilla.org/show_bug.cgi?id=18643)
which Wub supports, in which the browser's charset is supplied in a
<INPUT TYPE="HIDDEN" NAME="_charset_"> field ... have a read of that
URL, see what you make of it, and if you can think of ways to improve
what Wub does, I'm all ears.

Colin.

Reply all
Reply to author
Forward
0 new messages