URL中%25E6%2588这样%25开头的字符是什么编码

本文介绍了如何使用 OkHttp 3.8.1 的 FormBody.Builder 进行表单参数的构建与提交,并强调了在构建过程中会对参数进行 URL 编码这一关键细节。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://www.cnblogs.com/jx270/p/4829589.html

https://jingyan.baidu.com/article/6b182309ba6eaeba58e159cb.html


Okhttp3.8.1

FormBody.Builder
protected void appendParams(FormBody.Builder builder, Map<String, String> params) {

    if (params != null && !params.isEmpty()) {
        for (String key : params.keySet()) {
            builder.add(key, params.get(key));
        }
    }
}
注意了会进行Url编码。重要事情说三遍,会进行Url编码,会进行Url编码,会进行Url编码



'Option Explicit ' 声明Windows API函数(高效等待) 'Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal ms As Long) ' 界面控件声明 Private WithEvents cmdStart As CommandButton Private WithEvents cmdStop As CommandButton Private WithEvents Timer1 As Timer Private lblStatus As Label Private wsh As Object Private objWnd As Object ' 配置常量 Private Const ObjHour As Integer = 1 Private Const ObjMinute As Integer = 59 Private Const ObjSecond As Integer = 0 Private LastSwitchTime As Date ' 记录上次切换时间 Private isRunning As Boolean ' 程序运行状态标志 ' 窗体加载事件 - 初始化界面 Private Sub Form_Load() On Error Resume Next Set wsh = CreateObject("WScript.Shell") ' 创建界面控件 CreateControls ' 创建定时器(但不立即启用) Set Timer1 = Controls.Add("vb.timer", "Timer1") Timer1.Interval = 1000 ' 1秒检测一次 Timer1.Enabled = False ' 初始禁用定时器 ' 设置初始状态 lblStatus.Caption = "状态: 已停止" isRunning = False ' 创建信息窗口 Set objWnd = wsh.Exec("mshta.exe ""about:<title>页面自动程序</title><body bgcolor=white><center><h1>运行中</h1><p>系统每1分钟自动按一次F11和Tab键,防止桌面自动锁屏.<br> @@@@@点击停止按钮停止程序@@@@@</p></center><script>window.resizeTo(800,400);window.moveTo((screen.width-800)/2,(screen.height-400)/2);</script>""") If Err.Number <> 0 Then MsgBox "警告: " & Err.Description Err.Clear End If End Sub ' 创建界面控件 Private Sub CreateControls() ' 创建启动按钮 Set cmdStart = Controls.Add("VB.CommandButton", "cmdStart") With cmdStart .Caption = "启动" .Top = 20 .Left = 20 .Width = 80 .Height = 30 .BackColor = &H8000000F ' 浅灰色背景 .Font.Bold = True End With ' 创建停止按钮 Set cmdStop = Controls.Add("VB.CommandButton", "cmdStop") With cmdStop .Caption = "停止" .Top = 20 .Left = 120 .Width = 80 .Height = 30 .BackColor = &H8000000F .Enabled = False ' 初始禁用 .Font.Bold = True End With ' 创建状态标签 Set lblStatus = Controls.Add("VB.Label", "lblStatus") With lblStatus .Caption = "状态: 已停止" .Top = 60 .Left = 20 .Width = 180 .Height = 20 .Font.Bold = True End With End Sub ' 启动按钮点击事件 Private Sub cmdStart_Click() If isRunning Then Exit Sub ' 更新状态 isRunning = True lblStatus.Caption = "状态: 运行中" cmdStart.Enabled = False cmdStop.Enabled = True ' 打开浏览器页面 OpenBrowserUrls ' 启动定时器 Timer1.Enabled = True LastSwitchTime = Now End Sub ' 停止按钮点击事件 Private Sub cmdStop_Click() If Not isRunning Then Exit Sub ' 更新状态 isRunning = False lblStatus.Caption = "状态: 已停止" cmdStart.Enabled = True cmdStop.Enabled = False ' 停止定时器 Timer1.Enabled = False ' 关闭信息窗口 If Not objWnd Is Nothing Then objWnd.Terminate Set objWnd = Nothing End If ' 关闭所有Edge窗口(可选) ' wsh.Run "taskkill /f /im msedge.exe", 0, True End Sub Private Sub OpenBrowserUrls() Dim browserPath As String Dim urls(1 To 4) As String ' 4个URL browserPath = "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" urls(1) = "http://192.168.10.81/decision/view/form?viewlet=%25E5%2588%25B6%25E9%2580%25A02%25E9%2583%25A8%252F%25E7%25AC%25AC3%25E5%2588%25B6%25E9%2580%25A0%25E7%25A7%2591%252F%25E7%25AE%25A1%25E7%2590%2586%25E6%259D%25BF%252F%25E6%2580%25BB%25E8%25A3%2585%25E7%25BB%2584%25E7%25AE%25A1%25E7%2590%2586%25E6%259D%25BF%252F%25E7%25AC%25AC3%25E5%2588%25B6%25E9%2580%25A0%25E7%25A7%2591%25E6%2595%25B0%25E5%25AD%2597%25E5%258C%2596%25E5%258F%25AF%25E8%25A7%2586%25E7%2594%25BB%25E9%259D%25A2.frm&ref_t=design&ref_c=c1f4da3a-8211-44b6-94c4-3a88c1251739" '3科数字化页面 urls(2) = "http://192.168.154.11:4000/gridWebAndon/revoAssembly_Allparts" '#12线装配安东 urls(3) = "http://192.168.10.81/decision/view/form?viewlet=%25E5%2588%25B6%25E9%2580%25A02%25E9%2583%25A8%252F%25E7%25AC%25AC3%25E5%2588%25B6%25E9%2580%25A0%25E7%25A7%2591%252F%25E7%25AC%25AC3%25E5%2588%25B6%25E9%2580%25A0%25E7%25A7%2591%25E4%25BA%25BA%25E5%2591%2598%25E7%25AE%25A1%25E7%2590%2586%25E6%259D%25BF%252F%25E7%25AC%25AC3%25E5%2588%25B6%25E9%2580%25A0%25E7%25A7%2591%25E4%25BA%25BA%25E5%2591%2598%25E7%25AE%25A1%25E7%2590%2586%25E6%259D%25BF.frm&ref_t=design&ref_c=aa9c72db-5215-48d4-b36f-a5841c32c7c6" '人员管理板 urls(4) = "http://192.168.154.11:5000/gridWebAndon/revoAllparts" '#12线加工安东 Dim i As Integer For i = 1 To 4 ' 打开浏览器窗口 wsh.Run Chr(34) & browserPath & Chr(34) & " " & Chr(34) & urls(i) & Chr(34) DoEvents ' 等待页面加载 Sleep 2000 ' 确保窗口激活后再发送F11 wsh.AppActivate "Microsoft Edge" Sleep 500 ' 短暂延迟确保激活完成 wsh.SendKeys "{F11}" Next i ' 额外确保最后一个窗口全屏 wsh.AppActivate "Microsoft Edge" Sleep 500 wsh.SendKeys "{F11}" LastSwitchTime = Now ' 初始化切换时间 End Sub Private Sub Timer1_Timer() If Not isRunning Then Exit Sub Dim CurHour As Integer Dim CurMinute As Integer CurHour = Hour(Now) CurMinute = Minute(Now) ' 检查是否到达关机时间 If CurHour = ObjHour And CurMinute >= ObjMinute Then ' wsh.Run "cmd.exe /c shutdown -s -f" ' 关机命令 Exit Sub End If ' 每1分钟切换一次标签页 If DateDiff("n", LastSwitchTime, Now) >= 1 Then wsh.AppActivate "Microsoft Edge" Sleep 500 ' 确保窗口激活 wsh.SendKeys "^{TAB}" ' Ctrl+Tab切换标签页 LastSwitchTime = Now End If End Sub
最新发布
08-10
Option Explicit Private WithEvents Timer1 As Timer Private wsh As Object Private objWnd As Object Private LastSwitchTime As Date ' 记录上次切换时间 Private Sub Form_Load() On Error Resume Next Set wsh = CreateObject("WScript.Shell") Set objWnd = wsh.Exec("mshta.exe ""about:<title>running</title><body bgcolor=white><center><h1>Running</h1><p>Automatically press the F11 and TAB key every 1 minutes.<br> Please Close window to stop running</p></center><script>window.resizeTo(800,400);window.moveTo((screen.width-800)/2,(screen.height-400)/2);</script>""") If Err.Number <> 0 Then MsgBox "错误创建窗口: " & Err.Description Exit Sub End If Set Timer1 = Controls.Add("vb.timer", "Timer1") Timer1.Interval = 1000 ' 1秒检测一次 Timer1.Enabled = True OpenBrowserUrls End Sub Private Sub OpenBrowserUrls() Dim browserPath As String Dim urls(1 To 4) As String ' 4个URL browserPath = "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" urls(1) = "http://192.168.10.81/decision/view/form?viewlet=%252F%25E5%2588%25B6%25E9%2580%25A02%25E9%2583%25A8%252F%25E7%25AC%25AC3%25E5%2588%25B6%25E9%2580%25A0%25E7%25A7%2591%252F%25E7%25AC%25AC3%25E5%2588%25B6%25E9%2580%25A0%25E7%25A7%2591%25E4%25BA%25BA%25E5%2591%2598%25E7%25AE%25A1%25E7%2590%2586%25E6%259D%25BF%252F%25E7%25AC%25AC3%25E5%2588%25B6%25E9%2580%25A0%25E7%25A7%2591%25E4%25BA%25BA%25E5%2591%2598%25E7%25AE%25A1%25E7%2590%2586%25E6%259D%25BF-%25E5%25BD%2593%25E6%2597%25A5%25E8%2580%2583%25E5%258B%25A4.frm&__parameters__=%257B%2522__pi__%2522%253Afalse%252C%2522fine_hyperlink%2522%253A%2522b8deb218-2e1f-4ff2-945e-0accef795893%2522%257D&_=1753058018642" '当日出勤 urls(2) = "http://192.168.154.11:4000/gridWebAndon/revoAssembly_Allparts" '#12线装配安东 urls(3) = "http://192.168.10.81/decision/view/form?viewlet=%25E5%2588%25B6%25E9%2580%25A02%25E9%2583%25A8%252F%25E7%25AC%25AC3%25E5%2588%25B6%25E9%2580%25A0%25E7%25A7%2591%252F%25E7%25AC%25AC3%25E5%2588%25B6%25E9%2580%25A0%25E7%25A7%2591%25E4%25BA%25BA%25E5%2591%2598%25E7%25AE%25A1%25E7%2590%2586%25E6%259D%25BF%252F%25E7%25AC%25AC3%25E5%2588%25B6%25E9%2580%25A0%25E7%25A7%2591%25E4%25BA%25BA%25E5%2591%2598%25E7%25AE%25A1%25E7%2590%2586%25E6%259D%25BF.frm&ref_t=design&ref_c=aa9c72db-5215-48d4-b36f-a5841c32c7c6" '人员管理板 urls(4) = "http://192.168.154.11:5000/gridWebAndon/revoAllparts" '#12线加工安东 Dim i As Integer For i = 1 To 4 ' 打开浏览器窗口 wsh.Run Chr(34) & browserPath & Chr(34) & " " & Chr(34) & urls(i) & Chr(34) DoEvents ' 等待页面加载 Sleep 2000 ' 确保窗口激活后再发送F11 wsh.AppActivate "Microsoft Edge" Sleep 500 ' 短暂延迟确保激活完成 wsh.SendKeys "{F11}" Next i ' 额外确保最后一个窗口全屏 wsh.AppActivate "Microsoft Edge" Sleep 500 wsh.SendKeys "{F11}" LastSwitchTime = Now ' 初始化切换时间 End Sub Private Sub Timer1_Timer() Dim CurHour As Integer Dim CurMinute As Integer Dim CurSecond As Integer CurHour = Hour(Now) CurMinute = Minute(Now) CurSecond = Second(Now) ' 每1分钟切换一次标签页 If DateDiff("n", LastSwitchTime, Now) >= 1 Then wsh.AppActivate "Microsoft Edge" Sleep 500 ' 确保窗口激活 wsh.SendKeys "^{TAB}" ' Ctrl+Tab切换标签页 LastSwitchTime = Now End If End Sub Private Sub Sleep(ms As Long) Dim endTime As Date endTime = DateAdd("s", ms / 1000, Now) Do While Now < endTime DoEvents Loop End Sub
08-09
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值