gpt4 book ai didi

http - 在字符集方面使用#form# 和#getHttpRequestData()# 有什么区别?

转载 作者:可可西里 更新时间:2023-11-01 16:18:52 26 4
gpt4 key购买 nike

我有一个 coldfusion 页面,uni.cfm:

<cfprocessingdirective pageencoding="utf-8">
<cfscript>

<cfdump var="#form.a#" label="form">
<cfdump var="#getHttpRequestData().content#" label="form2">

发送以下 HTTP 请求会在返回的 html 中首先生成字符串 "???",然后是字符串 "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=ΠΣΩ

为什么#form.a# 不能正确处理二进制字符串,而 getHttpRequestData() 可以?

最佳答案

让发件人将内容类型更改为 multipart/form-data 而没有 url 编码就像一个魅力:

POST *URL* HTTP/1.1
Content-Type: multipart/form-data; boundary=AaB03x
Content-Length: 145

--AaB03x
Content-Disposition: form-data; name="a"

ΠΣΩ
--AaB03x--

然后可以使用#form.a# 并获得正确的字符串!

关于http - 在字符集方面使用#form# 和#getHttpRequestData()# 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10853622/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com