问题
I have a coldfusion page, uni.cfm:
<cfprocessingdirective pageencoding="utf-8">
<cfscript>
<cfdump var="#form.a#" label="form">
<cfdump var="#getHttpRequestData().content#" label="form2">
Sending the following HTTP request produces in the returned html first the string "???", then the string "a=ΠΣΩ".
POST http://localhost:8080/uni/unicode.cfm HTTP/1.1
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
User-Agent: unicli
Host: localhost:8080
Content-Length: 8
Pragma: no-cache
a=ΠΣΩ
Why does #form.a# NOT process the binary string correctly, while getHttpRequestData() does?
回答1:
Having the sender change content-type to multipart/form-data with NO url-encoding worked like a charm:
POST *URL* HTTP/1.1
Content-Type: multipart/form-data; boundary=AaB03x
Content-Length: 145
--AaB03x
Content-Disposition: form-data; name="a"
ΠΣΩ
--AaB03x--
Then able to use #form.a# and get the right string!
来源:https://stackoverflow.com/questions/10853622/whats-the-difference-between-using-form-and-gethttprequestdata-with-regar