What's the difference between using #form# and

2019-05-15 03:35发布

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条回答
爷、活的狠高调
2楼-- · 2019-05-15 04:11

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!

查看更多
登录 后发表回答